資源簡介
Python版的汽車WIN碼生成器
汽車行業可能需要
代碼片段和文件信息
#?-*-?coding:?utf-8?-*-
from?tkinter?import?*
class?Application(frame):
????def?__init__(self?master=None):
????????frame.__init__(self?master)
????????self.pack()
????????self.createWidgets()
????def?createWidgets(self):
????????self.nameInput1?=?Entry(self)
????????self.nameInput1.pack()
????????self.nameInput2?=?Entry(self)
????????self.nameInput2.pack()
????????self.vinText?=?Entry(self)
????????self.vinText.pack()
????????self.quitButton?=?Button(self?text=‘Make‘?command=self.makeVIN)
????????self.quitButton.pack()
????????self.quitButton?=?Button(self?text=‘Quit‘?command=self.quit)
????????self.quitButton.pack()
????def?makeVIN(self):
????????l8=str(self.nameInput1.get())
????????r8=str(self.nameInput2.get())?
????????self.vinText.insert(0GetVin(l8r8))
def?GetVINCheck(L8R8):
????????intWeights=[876543210098765432]
????????if?len(L8)!=8:
????????????return?‘?‘
????????if?len(R8)!=8:
????????????return?‘?‘
????????vin=L8+‘0‘+R8
????????vin.upper()
????????dictReplace={}
????????dictReplace[‘A‘]=1
????????dictReplace[‘B‘]=2
????????dictReplace[‘C‘]=3
????????dictReplace[‘D‘]=4
????????dictRepl
評論
共有 條評論