Thu, Feb 27, 2:15 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: 2025 Feb 05 6:41 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: Python Radio Button Help


3dtrue ( ) posted Wed, 20 April 2005 at 10:32 AM · edited Thu, 23 January 2025 at 1:31 PM

file_224912.txt

I am trying to add a radiobutton widget to my python script via Tkinter. I can make the radio button display, and i can return the result on the first radio click. If i click the radio buttons more than once however, the python script is unable to hear my new radio choices. The examples of using Python with the radio are kinda bleak. They are there, but seldom do the examples i have found actually call on the value. Again, this works, but only once. In fact, if you go under file and reinitialize python, the script again works fine (but only once). The script is designed to add noise to the current selected actor in the scene. You should be able to run this and it work the first radio click, then it no work no more. Anybody know why it's broken, or how i can fix it? I have attached the script for testing.


nruddock ( ) posted Wed, 20 April 2005 at 2:30 PM

Attached Link: http://www.pythonware.com/library/tkinter/introduction/radiobutton.htm

You didn't post your script but a copy of the message. The documentation suggests that the variable will track the value and vice versa, so you should just need to use the variables value to find the button state when you need it.


3dtrue ( ) posted Wed, 20 April 2005 at 3:05 PM

file_224913.txt

jeez, i'm a goof. Here's the script i hope.


3dtrue ( ) posted Wed, 20 April 2005 at 3:11 PM

Attached Link: http://www.3dtrue.com/poser/35.html

in case nobody discovers the problem, i have one work around. Namely, i created three separate command handlers for each radio button. This seems wrong but it solves the problem. So the script above will work if the lines with the handler def noiseTypeCB(self): are changed to def noiseTypeCB1(self) def noiseTypeCB2(self) def noiseTypeCB3(self)

And each radio button's command call needs the correct function number too. Again this seems wrong, but it works. Also, anyone wanting this script can get it from my site as part of the free PoserPython Vol I collection. I just added this noise script to Vol I. It was not in there before this morning.

Thanks for reading.


nruddock ( ) posted Wed, 20 April 2005 at 3:30 PM

This line looks suspect

self.noiseType = self.noiseType.get()

You probably meant self.noiseType = self.noiseV.get()

I'm not convinced the callback is really necessary, you should be able to just return self.noiseV.get()


3dtrue ( ) posted Wed, 20 April 2005 at 5:15 PM

you are right it used to say noiseV. Boy i have really screwed this whole thread up. So my fix overwrote my previous py's version with the problem, which i thought i had posted to this thread. anyways, sorry. still i know it didn't work till i applied the patch. I think the better post would have been to say, does anyone have a working example of using a Radiobutton in a python script and return the value properly? Yeah, i should have said that. :) cheers. james


PoseWorks ( ) posted Thu, 21 April 2005 at 10:36 PM

You're really better off just using a lambda statement for the command (command=lambda v=MyDesiredValue: MyFunction(v)). IntVar gets are generally unrelable in my experience.


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.