Mon, Nov 25, 4:52 AM CST

Renderosity Forums / Poser Python Scripting



Welcome to the Poser Python Scripting Forum

Forum Moderators: Staff

Poser Python Scripting F.A.Q (Last Updated: 2024 Sep 18 2:50 am)

We now have a ProPack Section in the Poser FreeStuff.
Check out the new Poser Python Wish List thread. If you have an idea for a script, jot it down and maybe someone can write it. If you're looking to write a script, check out this thread for useful suggestions.

Also, check out the official Python site for interpreters, sample code, applications, cool links and debuggers. This is THE central site for Python.

You can now attach text files to your posts to pass around scripts. Just attach the script as a txt file like you would a jpg or gif. Since the forum will use a random name for the file in the link, you should give instructions on what the file name should be and where to install it. Its a good idea to usually put that info right in the script file as well.

Checkout the Renderosity MarketPlace - Your source for digital art content!



Subject: passing variables to a class - tkinter


markschum ( ) posted Thu, 10 April 2008 at 10:17 AM · edited Mon, 25 November 2024 at 1:58 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.

My python page
My ShareCG freebies


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 :)


Privacy Notice

This site uses cookies to deliver the best experience. Our own cookies make user accounts and other features possible. Third-party cookies are used to display relevant ads and to analyze how Renderosity is used. By using our site, you acknowledge that you have read and understood our Terms of Service, including our Cookie Policy and our Privacy Policy.