Forum Moderators: Staff
Poser Python Scripting F.A.Q (Last Updated: 2024 Sep 18 2:50 am)
Short answer: Yes. P5 includes ver 2.2 of Python, and after reading your msg, I looked in the new TKinter.py script and found a family of grab functions that serve the purpose you describe. I hadn't heard of it before; guess I'd better read up on it! Controlling window focus is a huge problem, and it would be grand if this solves it.
My python page
My ShareCG freebies
Focus_set() (Focus() is the same thing) is probably what you need (w.focus() gives widget w focus when its window is clicked). Grab_set() takes ALL the events for the application, which usually makes it real hard to do anything outside the grabbing widget.
Focus_force() will give the widget and its window focus without having to click the window. You probably want to be a little thoughtful about doing this, as it's easy to be rude.
Also, lift() will bring your window to the top, if that's a problem.
I wish I had a good reference for this topic, but I don't. Try it out.
Attached Link: http://www.python.org/topics/tkinter/doc.html
hey, if you're reading Tkinter.py for documentation, you might want to try the documents in the link, not that you'll find any of them much help on this particular topic.Also thanks for reporting the version in P5. But is it 2.2 or 2.2.1?
Thanks for clarity. I was just making a quick check to see if grab() was present; I mainly use some PDF files from pythonware.org for docs. And the main Python22.dll is definitely plain 2.2, not 2.2.1.
My python page
My ShareCG freebies
OK, now I'm curious about focus control and disappearing windows in Poser Python and the idea that grabs might be the solution to something. What are the problems you're seeing?
I don't have ProPack (I'm waiting for P5 on OS X and hoping I'm not to be looking up admiringly at the flocks of pigs flying south over the skating rink in Hell when it arrives), so I apologize in advance if what I have to say is irrelevant to the real problem.
Do scripts launch windows that disappear behind the Poser window (which takes the whole display, naturally) once they lose focus? Do they have focus on launch?
If that's the case, I have a clue about why it happens, which I'll spare you. However, you might try these possible solutions:
For focus on launch of window w, use w.focus_force() in your script.
To keep the window on top, bind its FocusOut event, and in the handler raise the window to the top. Here's the short version. (Square for angle brackets):
w.bind( [FocusOut] , lambda e: w.lift())
Is this anywhere close to relevant?
c1rcle,
Guessing again, but is it a PATH problem? Have you tried changing $PATH and $PYTHONPATH so they're appropriate for what you're trying to use. If that's the problem, you could write a script to set the paths for whichever you want to use at the moment. I think they can't both be on the $PATH and both be happy is what I'm trying to say. HTH (MCH)
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.
I've just installed the newest version of python ready for when poser5 arrives in my sweaty hands & going through the manual I came across the grab function, what it does is locks the system so that only the active python window can be interacted with until you close that window. I'm wondering if this is in the python that ships with poser, if it is we can use it to solve the disappearing window problem we've had with python scripts up to now.