コード例 #1
0
    def main(self):
        '''
        Get a wx App
        Build the communicate Frame
        Enter wx main loop
        '''
        app = wx.PySimpleApp(redirect=True,
                             filename=None)
        frame = wx.Frame(None, title='Hello World')
        frame.Show()

        message = 'Started timestamped wxPython: stdout/stderr\n\n' + \
                  'Print statements and other standard output ' + \
                  'will now be directed to this window.'

        self.theWindowLogger.info(message)

        self.theWindowLogger.debug('Before MainLoop')

        parent = frame
        baseLabel = 'Greetings!'
        baseStyle = 0 # wx.BORDER_SIMPLE
        baseCol = 5
        baseRow = 10
        basePos = wx.tsGetPixelValues(baseCol, baseRow)
        if baseStyle == 0:
            baseSize = wx.tsGetPixelValues(len(baseLabel) + 1, 1)
        else:
            baseSize = wx.tsGetPixelValues(len(baseLabel) + 4, 1 + 2)
        junk = wxStaticText(
            parent,
            id=wx.ID_ANY,
            label=baseLabel,
            pos=basePos,
            size=baseSize,
            style=baseStyle,
            validator=wx.DefaultValidator,
            name=wx.StaticTextNameStr)
        junk.Show()

        print("Before MainLoop")
        app.MainLoop()
        print("After MainLoop")
        self.theWindowLogger.debug('After MainLoop')