Forum: Poser Python Scripting


Subject: Python References

jcarp opened this issue on Mar 23, 2001 ยท 6 posts


jcarp posted Fri, 23 March 2001 at 5:19 PM

Attached Link: http://www.nmt.edu/tcc/help/pubs/lang.html

I stumbled over this trying to solve a Tkintr puzzlement. The Tkintr reference fills in some gaps in the other documentation for it that I've seen, which more than makes up for the awful, awful font (for trying to read) they've chosen.

Mason posted Fri, 23 March 2001 at 9:43 PM

Speaking of TKintr, I'm having problems with one of my scripts. I can get a dialog to appear and enter my data but, when I try to rerun the script, poser says it cannot create anymore frames. Am I supposed to use Frame or Toplevel for my main dialog window.


jbrugion posted Fri, 23 March 2001 at 11:21 PM

Mason- post your script if the stuff below doesn't work. I think I know what your problem is as I ran into something similar. Want to start you script something like this: root=Tk() # rest of script. Use root as master for gui items root.mainloop() If you don't do the root=Tk() and then use root as the master to feed into all your gui items, when you exit the script you basically kill off the Tkinter instance that's running and he next Tkinter call in the next script you run will generate error messages. For example, if you just did a "Label(text="test") you'll kill the Tkinter instance that's running. Instead you want to do a Label(root, text="test"). This way root is feed in to the Label as the master so that when the Label is destroyed the script local instance of Tkinter, generated by the root=Tk(), is destroyed instead of the main instance. If you kill the Tkinter instance you then have to do a Reinitialize Python off the main Poser menu. Hope this helps. P.S. Try: http://www.pythonware.com/library/tkinter/ for the intro to Tkinter and http://www.python.org/doc/life-preserver/ for the Tkinter life preserver


bushi posted Sat, 24 March 2001 at 12:31 AM

I'd also suggest setting up as much as your script as possible outside of Poser. This is especially true for the TkInter stuff since Poser seems to not handle these types of problems very well. I've been using PythonWin to setup and test the GUI parts of the scripts with just 'pass' stubs in the callback handlers. After all that works, I go back in and add the Poser related code. It has saved me lots of headaches.


bushi posted Sat, 24 March 2001 at 9:51 PM

jcarp - DLed the docs. They do look very useful. I see what you mean about the fonts. Yuck! If you run across any other little gems, please pass them on. :-)


jcarp posted Sat, 24 March 2001 at 10:22 PM

bushi -- sure thing. UHHH, I notice I spell 'Tkinter' incorrectly and that Mason found that sort of infectious. It's an annoying word to habitually misspell 'import'-wise, and I beg forgiveness for leading anyone down that road.