File: AttrMixinFrame.py

package info (click to toggle)
boa-constructor 0.3.0-3
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 8,188 kB
  • ctags: 8,857
  • sloc: python: 54,163; sh: 66; makefile: 36
file content (54 lines) | stat: -rw-r--r-- 1,802 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#Boa:Frame:AttrMixinFrame

""" Example module which demonstrates the use of Attribute Mixin classes.

Attribute Mixin classes can be used to centralise attribute declarations
that can be shared between frames.

The mixin class name must end with the postfix _AttrMixin.

"""

from wxPython.wx import *

# Note: The AttrMixin class must be imported in this form and it's module must
#       be in the same directory as the frame module
from AttrMixins import Test_AttrMixin

def create(parent):
    return AttrMixinFrame(parent)

[wxID_ATTRMIXINFRAME, wxID_ATTRMIXINFRAMEBUTTON1,
] = map(lambda _init_ctrls: wxNewId(), range(2))

# Note: Inherits from the AttrMixin class after wxFrame
class AttrMixinFrame(wxFrame, Test_AttrMixin):
    def _init_utils(self):
        # generated method, don't edit
        pass

    def _init_ctrls(self, prnt):
        # generated method, don't edit
        wxFrame.__init__(self, id=wxID_ATTRMIXINFRAME, name='AttrMixinFrame',
              parent=prnt, pos=wxPoint(352, 222), size=wxSize(201, 104),
              style=wxDEFAULT_FRAME_STYLE, title=self.frameTitle)
        self._init_utils()
        self.SetClientSize(wxSize(193, 77))

        self.button1 = wxButton(id=wxID_ATTRMIXINFRAMEBUTTON1,
              label=self.buttonLabel, name='button1', parent=self,
              pos=wxPoint(0, 0), size=wxSize(193, 77), style=0)

    def __init__(self, parent):
        # Note: Call inherited mixin constructor before _init_ctrls
        Test_AttrMixin.__init__(self)

        self._init_ctrls(parent)


if __name__ == '__main__':
    app = wxPySimpleApp()
    wxInitAllImageHandlers()
    frame = create(None)
    frame.Show();frame.Hide();frame.Show() #workaround for running in wxProcess
    app.MainLoop()