Forum: Poser - OFFICIAL


Subject: wxPYTHON: Immediate help needed please - probably only 10 minutes to solve

KarinaKiev opened this issue on Jun 21, 2019 ยท 16 posts


KarinaKiev posted Fri, 21 June 2019 at 1:04 PM

Hello @all:

I need a little help with a wxPython script, and urgently because I want to release SASHA-16 (2019 Edition) tomorrow.

Normally I prefer to fight my own way to learn how everything works. But this is one of the cases where my brain (or what's still left of it) has evaporated and I'm out of options.

Please have a look at this script:

import poser, wx

HeaderText = r"""NOTICE:"""

txt1 = r"""Karina's Python Scripts:"""

txt2 = r"""All my scripts can be more easily accessed in
            ->> KARINA's TOOL BOX <- 
                               (in the POSE library tab)"""

class InlineHelp(wx.Frame):

    
    
    def __init__(self, *args, **kw):
        on_top = wx.DEFAULT_FRAME_STYLE | wx.STAY_ON_TOP
        wx.Frame.__init__(self, None, title= HeaderText, style=on_top)
        self.InitUI()

    def InitUI(self):
            
        self.panel = wx.Panel(self)
        vbox = wx.BoxSizer(wx.VERTICAL)
        btn_vbox = wx.StdDialogButtonSizer()
        
        self.declareElements()
                
        self.btn1.SetPosition((190,100))
        self.btn1.SetDefault()
         
        self.btn1.Bind(wx.EVT_BUTTON, self.showFolder)

        font1 = wx.Font(10, wx.DEFAULT, wx.NORMAL, wx.BOLD)
        font2 = wx.Font(10, wx.DEFAULT, wx.NORMAL, wx.DEFAULT)
                
        st1 = wx.StaticText(self.panel, label=txt1, style=wx.ALIGN_LEFT)
        st2 = wx.StaticText(self.panel, label=txt2, style=wx.ALIGN_LEFT)

        st1.SetFont(font1)
        st2.SetFont(font2)

        if txt1:
            vbox.Add(st1, flag=wx.ALL, border=10)
            vbox.Add(self.btn1, flag=wx.ALL, border=10)

        self.panel.SetSizer(vbox)
        vbox.Fit(self)
        self.Centre()
    
    def declareElements(self):
        
        self.btn1 = wx.Button(self.panel, label = "[ SHOW FOLDER ANYWAY ]", size = (160,22))

    def showFolder(self, event):
        msg = ""
        if 1:
            # Don't bother with this part.
            print "This will now open the 'poserScripts' folder in the Poser native library"    
            
        else:
            msg = "An error ocurred. n n I don't have the slightest idea what caused it. n Sorry!"

        self.Destroy()
        if len(msg):
            poser.DialogSimple.MessageBox(msg)
        
    
    def abortProgram(self, event):
        self.Destroy()


def main():

    app = poser.WxAuiManager()
    ilh = InlineHelp(None)
    ilh.Show()

main()

and if you have a few minutes to spare, please format the two text elements and the "[ SHOW FOLDER ANYWAY ]" button so that they fit into the window (eventually rescaling the window too)...

. . Thank you a lot!!!

Karina