Forum: Poser Python Scripting


Subject: Non-docking option for wxPython windows?

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


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()