我是初学者,使用 tkinter 制作了我的第一个 GUI 计算器。我想将我的 py 文件转换为 exe 文件。我尝试使用pyinstaller,auto-py-to-exe但是当文件准备好并运行时,它显示 Windows 错误框Cannot run Script main,我的文件名是 main .
import getpass
from os import mkdir
import tkinter,os,time
from functools import partial
from tkinter import PhotoImage
from tkinter.constants import SEL
class 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 图片时出错,所以你可以在https://github.com/01TanmayDaga/Calculator找到图片
请帮我!!
收到一只叮咚
相关分类