Reputation: 13
I would like to ask when I run the file in Pycharm, it able to show the calendar Show Calendar, but when I convert from py file to .exe format, it show no error but my calendar show nothing As show in here. I have pip install tkcalendar but may I know why my calendar not appear after convert into .exe format. I using python 3.8.2
Below are my code:
def chooseStartDate():
def print_sel():
global startDate
startDate = cal.selection_get()
tk.Label(this, text=startDate).grid(row=4, column=2)
top.destroy()
top = tk.Toplevel(this)
now = datetime.datetime.now()
cal = Calendar(top, font="Arial 14", selectmode='day', year=now.year, month=now.month, day=now.day)
cal.pack(fill="both", expand=True)
tk.Button(top, text="ok", command=print_sel).pack()
this = tk.Tk()
tk.Label(this, text="Start Date: ").grid(row=4, column=0)
tk.Button(this, text="Choose Date", command=chooseStartDate).grid(row=4, column=1)
this.mainloop()
Thank you.
Upvotes: 1
Views: 1775
Reputation: 41
Please use --hiddenimport=babel.numbers
while generating the exe file.
This should resolve the issue.
pyinstaller.exe --onefile -w --hiddenimport=babel.numbers your_script_name.py
Upvotes: 4