Home > database >  PyInstaller Exe behaves differently to script
PyInstaller Exe behaves differently to script

Time:10-13

Aight so I'm getting a user input from a secondary window using customtkinter.

When running the script from MSCode everything works fine.

  • The User inputs into the CTkEntry widget.
  • The textvariable properly assigns value.
  • This value is accessed elsewhere.

However, when I use pyinstaller to create an .exe of the same script, the textvariable simply stops assigning it's value to the textvariable

Can anyone point me to where/what may be cause an error such as this?
Is it that these mods are not compatible?

As a side note: I am using CTkEntry in a similar manor with the main window and have had no such issues with it with identical syntax.

I'm using auto-py-to-exe with settings:

  • One Directory
  • Console Based (for dubugging)
  • Locating the customTkinter lib folder
  • --hiddenimport win32timezone (throws errors otherwise)

The window looks like:

self.entryString = tkinter.StringVar()
entryWidget = customtkinter.CTkEntry(master=self.window, textvariable=self.entryString)
entryWidget.pack()
customtkinter.CTkButton(master=self.window, text="Done", command=self.dismissWindow).pack()

Which is later accessed using:

self.entryString.get()

CodePudding user response:

Alright so to close the question I did find and solve my issue.

I have a root window main. Inside main I have a button that opens another window form for the user to interact with. form itself also opens new windows.

The windows created with form are TkTopLevel , as they should be (I'm under the impression one should avoid multiple root windows)

What I didn't realise was that form was a root window, and not a TkTopLevel. So when I returned to main, the textvariables in form were not updating their values. I have no idea what specifically causes this error within the Tk library, but after changing form to a TkTopLevel the interactions worked as intended.

  • Related