Tue, Nov 19, 7:29 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: wxPython and UI controls... Did anyone code any Poser-like replacements?


Dizzi ( ) posted Sun, 01 August 2010 at 9:54 AM · edited Tue, 19 November 2024 at 7:23 AM

While wxPython  is really nice in the way it integrates in the UI, it's downside is the use of OS generic controls which do not allow enough customization to make them really integrate in Poser's UI.

For example if you're using a wx.ListBox, you can set foreground (font) and background color but you cannot change the colors for selected elements, they'll display with the system colors. And even worse, on a Mac they don't change at all.
Same problem with a Textbox: colors change on Windows and don't change on the Mac.
Even worse (both Windows and Mac): wx.RadioButtons only change the background color, foreground does not work...

So, did anyone of you a) find a workaround for that (other than adjusting your system settings to match Poser's UI colors ;-)) or b) code some replacement controls?



bagginsbill ( ) posted Sun, 01 August 2010 at 10:53 AM

You should ask SM. The entire UI is wx, so clearly you are attempting to integrate wx with wx and not aware of how Poser does it. Neither am I, or I'd say.


Renderosity forum reply notifications are wonky. If I read a follow-up in a thread, but I don't myself reply, then notifications no longer happen AT ALL on that thread. So if I seem to be ignoring a question, that's why. (Updated September 23, 2019)


Dizzi ( ) posted Sun, 01 August 2010 at 11:43 AM

Yes, guess I have to ask SM, but that way I can't finish it today :-)



nruddock ( ) posted Sun, 01 August 2010 at 12:29 PM

All the Poser UI elements appear to be based on custom classes (apart from the splitters) wxWidgetCanvas and wxPoserChildFrame.
These presumably are a container for the PSD resource based controls and the Poser style window frame, and we have no access to these (otherwise is would be easy to match the internal UI style), so to match UI styleyou'd need to subclass standard controls and override the appropriate drawing functons.


Dizzi ( ) posted Mon, 02 August 2010 at 11:58 AM

Well, SM support confirms that it's currently not possible.

As CheckBox and RadioButton are my main concern, I just accompany empty labeled ones with  a StaticText in my own CheckBox and RadioButton classes. That way the color can be changed...



Netherworks ( ) posted Mon, 30 August 2010 at 1:16 PM

Yeah, it involves a lot of workarounds and extra pushing to try and get things to look integrated.  It's funny that something that is supposed to be a GUI cannot allow you to fully and more or less easily design the UI the way you have a vision for it.

Its certainly not SM's fault.

Tkinter is just as bad when you are going cross-platform.

But back to wxpython, I've found that buttons and panes you can get at pretty well.  You can even throw a graphic tile on the pane to get a Poser "sandstone" look, however it feels like such a hack/workaround to get it in there.  But you're right, listboxes and the other elements wind up looking generic and funky on the mac.

Another thing that blows me away is information is often kind of spotty so you either have to hunt for ages or blow up Poser's UI a few times to figure things out.  At least that's my experience.  LOL

.


Dizzi ( ) posted Mon, 30 August 2010 at 1:53 PM

I wonder why it's always the Mac versions that need special treatment. Be it Java, Mono, WxPython. It works fine on Windows and Linux, but you have to do all kind of weird stuff to get the Mac things working (if you or your testers don't lose interest before it's done).

I have my own check boxes and radio buttons (using the regular ones+labels) to get those suckers colored properly... But coding everything again is kind of ... counterproductive...
I wonder if Poser faces the same problem with the numeric inputs for the dials... Those also pop up another input after clicking... maybe the regular numeric input is resistant to background color changes, too, like wx.lib.masked.numctrl... ;-)



Netherworks ( ) posted Mon, 30 August 2010 at 2:27 PM · edited Mon, 30 August 2010 at 2:28 PM

That's even true of tkinter and poser's dialog resources.  I had scripts failing on Mac with dialog resource cannot be found (or somesuch) and I had to define where the poser UI elements are. o.o

Normally, we can do this:

dlg = poser.Dialog(file="./Runtime/ui/simpleDlgOk.xml", message=msg, width=wd, height=ht)

but I found that instead I had to do this (or similar) or Mac OSX 10 was having a baby:

poserPath = os.path.split(poser.AppLocation())[0]
okPath = os.path.join(poserPath, 'Runtime', 'ui', 'simpleDlgOk.xml')
dlg = poser.Dialog(file=okPath, message=msg, width=wd, height=ht)

.


nruddock ( ) posted Mon, 30 August 2010 at 3:09 PM

That's just due to the difference of what Windows and MacOS consider the current directory to be.
Using an absolute path is always going to be safer cross-platform, unless you're really sure where a relative path is going to be based on.


Netherworks ( ) posted Mon, 30 August 2010 at 3:18 PM

I guess I just made the wrong assumption that file="./Runtime/ui/simpleDlgOk.xml" would be cross-platform since the "example" scripts also use this.  Maybe Mac has completely different versions of the scripts that come with Poser?  Hard to make everyone happy if you're getting the wrong information to start with :D

.


nruddock ( ) posted Mon, 30 August 2010 at 4:06 PM

Starting a path with "." makes it relative to the current directory.

For Windows this will be the directory in which the EXE being launched from (by a double click) is, or the directory specified by the shortcut as "Start in:"
Windows also keeps a current directory for each drive which can make for a gotcha.
I don't know the specifics of MacOS's behaviour, but I'd expect the current directory to be the user's "home directory".

Command prompts on both behave similarly, in that the current directory is where you may have changed it to (not sure how this affects Windows shortcuts, but would any EXEs started).


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.