markschum opened this issue on Apr 10, 2008 · 9 posts
markschum posted Thu, 10 April 2008 at 10:17 AM
Hi all,
I have a scipt I am writing that will use tkinter for a user gui. That bits working .
I want to do some stuff BEFORE initiating the gui and I have worked out that it can be done and that bit is working. It consists of getting a folder path using the dialog and a project name and verifying that the folders have been created and the project name is valid .
The problem I have is getting a variable into the class code.
I have used a global definition for the variable name and I get an error message saying the variable has not been defined in the statement that uses it within the class code .
self.mystatus = Label(self, relief = GROOVE)
self.mystatus.config(text = outpath)
Any ideas ?
If I put the dialog inside thhe class it doesnt work :(
probably to do with setting the parent window
PhilC posted Thu, 10 April 2008 at 10:26 AM
Have you declared outpath as a global variable at the beginning of the class?
markschum posted Thu, 10 April 2008 at 10:29 AM
Hi phil,
I sorted it out !
I hadnt declared it Glabal in the function that set it. I wasnt aware that you have to declare a global more than once :( seems odd to me but its working now .
PhilC posted Thu, 10 April 2008 at 10:39 AM
Yes that would do it :)
markschum posted Thu, 10 April 2008 at 11:19 AM
I am rethinking the whole thing now :)
It works , but its ugly , and I dislike ugly user interfaces .
Another think though, sometimes when I start a script that uses tkinter I get multiple windows open of the gui. Is this simply multiple invocations of the script , or is there some issue within tkinter that spawns multiple copies of it ?
PhilC posted Thu, 10 April 2008 at 11:43 AM
It could be from previous aborted instances of the script still running. When I get that during development of a script I restart Poser.
ockham posted Sun, 13 April 2008 at 11:15 PM
Tkinter has some sort of hidden memory that preserves its windows
between invocations. Usually you can just use the menu choice to Reinitialize Python.
nruddock posted Mon, 14 April 2008 at 2:09 PM
What your seeing are orphaned toplevel windows.
As ockhams says reinitialising should be enough, but I'd shutdown and restart to be absolultely sure everythings in a normal state.
markschum posted Mon, 14 April 2008 at 2:19 PM
ok, thats good... with all the crashes I get testing I need to start reinitializing python more :( or writing better code first :)