我是初學(xué)者,使用 tkinter 制作了我的第一個(gè) GUI 計(jì)算器。我想將我的 py 文件轉(zhuǎn)換為 exe 文件。我嘗試使用pyinstaller,auto-py-to-exe但是當(dāng)文件準(zhǔn)備好并運(yùn)行時(shí),它顯示 Windows 錯(cuò)誤框Cannot run Script main,我的文件名是 main .import getpassfrom os import mkdirimport tkinter,os,timefrom functools import partialfrom tkinter import PhotoImagefrom tkinter.constants import SELclass Calculator(tkinter.Tk): '''This class creates calculator using tkinter module''' def __init__(self): super().__init__() # Changing height and width of window self.geometry('279x316') self.resizable(False,False) self.title('Calculator') image=PhotoImage('download.ico') self.iconbitmap(image) # Creating tkinter varible to store what user has entered self.__store_value=tkinter.StringVar() self.__store_value.set('') #Creating entry widget for input self.__input_user=tkinter.Entry(self,font='lucidia 20 bold',textvariable=self.__store_value) self.__input_user.pack(fill='x') self.bind('<Return>',partial(self.click,'=')) # This Buttons will be ther in calculator self._button_dict={"C":"C","(":"(",")":")","/":"/", "9":9,"8":8,"7":7,"*":"*", "6":6,"5":5,"4":4,"+":"+", "3":3,"2":2,"1":1,"-":"-", "His":"His","0":0,".":".","=":"="} def create_button(self,row=5,column=4): '''Creates button in the window,button_dict contains name of each button and an argument to be given to click function when pressed,no of rows in calculator and no. of columns''' self.__main_frame=tkinter.Frame(self) self.__main_frame.pack(fill='both') k=0 for i in range(row): for r in range(column): 我在上傳 ico 圖片時(shí)出錯(cuò),所以你可以在https://github.com/01TanmayDaga/Calculator找到圖片請(qǐng)幫我!!
試圖將python文件轉(zhuǎn)換為可執(zhí)行文件
料青山看我應(yīng)如是
2023-05-23 10:49:18