Esempio n. 1
0
MenuBar._meta.valid_children = [Menu, ] 
Menu._meta.valid_children = [MenuItem, MenuItemCheckable, MenuItemSeparator, Menu] 

# Unit Test

if __name__ == '__main__' :
    import sys, os
    
    # disable ubuntu unity menubar
    os.environ['UBUNTU_MENUPROXY'] = '0'
    
    app = wx.App(redirect=False)
        
    from gui.windows import Window

    w = Window(title="hello world", name="frmTest", tool_window=False, 
               resizable=True, visible=False, pos=(180, 0))

    mb = MenuBar(w, name="menubar") 
    m1 = Menu(mb, label='File', name="mnu_file")
    mi11 = MenuItem(m1, label='Open', name='menu_file_open')
    mi12 = MenuItem(m1, label='Save', name='menu_file_save', enabled=False)
    mi13 = MenuItem(m1, label='Quit', name='menu_file_quit')
    m11 = Menu(m1, label='Recent files', name="mnu_recent_file")
    mi111 = MenuItem(m11, label='file1', name='menu_recent_file1')
    mi112 = MenuItem(m11, label='file2', name='menu_recent_file2')
    mi113 = MenuItem(m11, label='file3', name='menu_recent_file3')
    m2 = Menu(mb, label='Edit', name="mnu_edit")
    mi21 = MenuItem(m2, label='Copy', name='menu_edit_copy')
    mi22 = MenuItem(m2, label='Cut', name='menu_edit_cut')
    mi23 = MenuItem(m2, label='Paste', name='menu_edit_paste')
Esempio n. 2
0
        self.f1.Show(visible)
        self.f2.Show(visible)


#----------------------------------------------------------------------

if __name__ == '__main__':
    import sys, os
    app = wx.App(redirect=None)

    from gui.controls import Button, Label, TextBox, CheckBox, ListBox, ComboBox
    from gui.windows import Window

    w = Window(title="hello world",
               name="frmTest",
               tool_window=False,
               resizable=True,
               visible=False,
               pos=(180, 0))

    o = Button(w, name="btnTest", label="click me!", default=True)
    o = Label(w,
              name="lblTest",
              alignment="right",
              size=(-1, 500),
              text="hello!")
    o = TextBox(w, name="txtTest", border=False, text="hello world!")
    o = CheckBox(w, name="chkTest", border='none', label="Check me!")
    o = ListBox(w,
                name="lstTest",
                border='none',
                items={
Esempio n. 3
0
        ##SubComponent.set_parent(self, new_parent, init)
        self.wx_obj.SetOwner(new_parent.wx_obj.GetEventHandler())

    def stop(self):
        self.wx_obj.Stop()
    
    def start(self, interval=-1):
        self.wx_obj.Start(interval)

    interval = Spec(lambda self: self.wx_obj.GetInterval(), 
                lambda self, value: self.wx_obj.Start(value),
                default=1000, type="integer",
                doc="current interval for the timer (in milliseconds)")


if __name__ == "__main__":
    from gui.windows import Window
    app = wx.App(redirect=False)

    w = Window(title="hello world", name="frmTest", tool_window=False, 
               resizable=True, visible=False, pos=(180, 0))
    t = Timer(w)
    def timer(evt):
        print("timer!")
    w.ontimer = timer
    t.interval = 100
    w.show()
    app.MainLoop()