Forum: Poser Python Scripting


Subject: Non-docking option for wxPython windows?

face_off opened this issue on Jun 18, 2012 · 5 posts


face_off posted Mon, 18 June 2012 at 12:19 AM

Hi

I haave searched the wxPython doco high and low, and been unable to determine how to create a wx.Panel window in Poser that does NOT dock when moved on the Poser UI (ie. I want it always floating).  Does anyone know how to do this?

Thanks

Creator of PoserPhysics
Creator of OctaneRender for Poser
Blog
Facebook


grichter posted Mon, 18 June 2012 at 2:20 AM

no...just starting to mess with wxpython myself and studying the examples under scriptsmenu:partners: that came with p9 and PP2012

they are uncompressed py's in there that do not dock (they float) also snarly's scenefixer is the same uncompressed py that floats that you can see the code used to create the window-panel.

Have a look at those scripts it should give you a hint of how it is done

 

what I am trying to figure out is a window-panel that sets to a given minimum size and if needed to based on a list of figures and props in a scene grows bigger in the vertical dimension (some are short lists and some are longer lists based on the number of items in a scene that I want to automatically stretch the window to accomodate.

Good luck

Gary

 

 

 

Gary

"Those who lose themselves in a passion lose less than those who lose their passion"


PhilC posted Mon, 18 June 2012 at 2:38 AM

Here is an example of a non-docking wxPython window taken from my Python for Poser Tutorial/Manual.

 

"Hello World" wxPython script.

import wx
import wx.py
import wx.aui

try:
    import poser
    scene = poser.Scene()
    man = poser.WxAuiManager()
    root = man.GetManagedWindow()
    print "Running in Poser 8"
    standalone = 0
except:
    standalone = 1

class MyApp(wx.Frame):
    def init(self,parent,title):
        wx.Frame.init(self,parent,title=title,size=(300,200))

        # add panel
        self.p = wx.Panel(self,id=wx.NewId(),size=(300,200))

        # Background colour to match Poser 8
        # Note that is coloUr not color. Yeah Queen's English :)
        self.p.SetBackgroundColour("#4B4B4B")

        # text label
        self.t1 = wx.StaticText(self,-1,"HELLO WORLD",pos=(10,20))
        self.t1.SetForegroundColour("#FFFFFF")
        self.t1.SetBackgroundColour("#4B4B4B")

if name == 'main':
    if standalone == 1:       
        app = wx.App(False)
        frame = MyApp(None, "Hello World")
        frame.Show(True)
        app.MainLoop()
    else:
        frame = MyApp(None, "Hello World")
        frame.Show()
       


face_off posted Mon, 18 June 2012 at 3:07 AM

Thanks Phil

So basically you do a wx.Frame rather than a wx.Panel, and do not use the poser.WxAuiManager().  Appreciate the help.  I'll try that.

Whilst on the subject, have you tried modal frames/dialogs?  I tried a number of ways to do this, but they all failed (can't remember the error/result), so I figured Poser didn't support modal for a specifc reason.

Creator of PoserPhysics
Creator of OctaneRender for Poser
Blog
Facebook


semidieu posted Tue, 19 June 2012 at 8:32 AM

They do support modal, at least for wxDialog...

 

Interesting to see that you don't need to use the WxAuiManager... Question is... if you do without it, is it still possible to determine if the frame was already opened, to avoid having the same script running twice ? (going to try this a little later)