Forum: Poser Python Scripting


Subject: How do I get showerror/showinfo/xxx to work?

Montressor opened this issue on Apr 16, 2002 ยท 4 posts


Montressor posted Tue, 16 April 2002 at 2:39 AM

When I do a showerror I do not get any text in the messagebox until I kill the Python task. Is this a bug, or am I just doing something stoooopid?


ockham posted Wed, 17 April 2002 at 11:34 AM

I'm not sure what "showerror" is; I don't see it anywhere in the Python built-in functions or the Poser API. But this kind of behavior is common, especially when using the TKinter setup. Python is rather clumsy about claiming the Active Window or the keyboard Focus. For instance, when I do a "raise" command in Python, which is supposed to print an error message in a separate box, the box sometimes appears at the right time, sometimes appears only after the TKinter frame is closed, sometimes appears with no contents but fills in the contents after the Python task is closed.

My python page
My ShareCG freebies


bushi posted Thu, 18 April 2002 at 9:57 PM

You can keep things in sync better if you use the ProcessSomeEvents method placed throughout your code. You'll have to tinker a bit to find the best placement. Oh, and as an added bonus try it with out specifying the number of events to process ie.: ProcessSomeEvents() It appears that using this form lets Poser process as few or as many as it needs to before returning.


Montressor posted Sun, 21 April 2002 at 12:22 PM

OK, I have it. So no one else has to go crazy, here it is.

First, you have to create a dialog of some kind. For instance (assuming your Tk root is called 'root'):

Pmw.initialise(root=root)
Pmw.aboutversion('1.0')
Pmw.aboutcopyright('Copyright Montressor 2002.nAll rights reservered')
Pmw.aboutcontact('Yell at me')
app.aboutdialog = Pmw.AboutDialog(root,applicationname="Montressor's Poser Aid")
app.aboutdialog.withdraw()

When you want to display this puppy, you have to do this:

app.aboutdialog.show()
app.aboutdialog.focus_set()

Hope this helps someone

Montressor