example.py
changeset 1 69318aba22bf
parent 0 a35731b5e31a
child 2 684cdc352562
equal deleted inserted replaced
0:a35731b5e31a 1:69318aba22bf
     2 # -*- coding: utf-8 -*-
     2 # -*- coding: utf-8 -*-
     3 
     3 
     4 import locale
     4 import locale
     5 locale.setlocale(locale.LC_ALL, '')
     5 locale.setlocale(locale.LC_ALL, '')
     6 
     6 
     7 import os
     7 from tuikit import *
     8 
       
     9 from tuikit.application import Application
       
    10 from tuikit.editfield import EditField
       
    11 from tuikit.window import Window
       
    12 from tuikit.button import Button
       
    13 from tuikit.scrollbar import VScrollbar
       
    14 from tuikit.textedit import TextEdit
       
    15 from tuikit.menubar import MenuBar
       
    16 from tuikit.menu import Menu
       
    17 from tuikit.layout import VerticalLayout
       
    18 
     8 
    19 
     9 
    20 class MyApplication(Application):
    10 class MyApplication(Application):
    21     def __init__(self):
    11     def __init__(self):
    22         Application.__init__(self)
    12         Application.__init__(self)
    23         self.top.connect('keypress', self.globalkeypress)
    13         self.top.connect('keypress', self.globalkeypress)
    24 
    14 
    25         menubar = MenuBar()
    15         menubar = MenuBar()
    26         self.top.add(menubar)
    16         self.top.add(menubar)
    27 
    17 
    28         filemenu = Menu(['New', '-', 'Open', 'Save', '-', 'Quit'])
    18         win = Window()
       
    19         self.top.add(win)
       
    20         win.x = 10
       
    21         win.y = 5
       
    22         win.allowlayout = False
       
    23 
       
    24 
       
    25         filemenu = Menu([
       
    26             ('New', None),
       
    27             None,
       
    28             ('Open', None),
       
    29             ('Save', None),
       
    30             None,
       
    31             ('Quit', self.terminate),
       
    32             ])
    29         self.top.add(filemenu)
    33         self.top.add(filemenu)
    30         filemenu.allowlayout = False
       
    31         filemenu.hidden = True
       
    32 
    34 
    33         editmenu = Menu(['Copy', 'Paste'])
    35         editmenu = Menu([('Copy', None), ('Paste', None)])
       
    36         helpmenu = Menu([('About', None)])
       
    37 
    34         self.top.add(editmenu)
    38         self.top.add(editmenu)
    35         editmenu.allowlayout = False
       
    36         editmenu.hidden = True
       
    37 
       
    38         helpmenu = Menu(['About'])
       
    39         self.top.add(helpmenu)
    39         self.top.add(helpmenu)
    40         helpmenu.allowlayout = False
       
    41         helpmenu.hidden = True
       
    42 
    40 
    43         menubar.setitems([
    41         menubar.setitems([
    44             ('File', filemenu),
    42             ('File', filemenu),
    45             ('Edit', editmenu),
    43             ('Edit', editmenu),
    46             ('Help', helpmenu)
    44             ('Help', helpmenu),
    47             ])
    45             ])
    48 
    46 
    49         vert = VerticalLayout()
    47         vert = VerticalLayout()
    50         self.top.layout(vert)
    48         self.top.layout(vert)
    51 
    49 
    52 
       
    53         #win = Window()
       
    54         #self.top.add(win)
       
    55 
    50 
    56         #button = Button('click!')
    51         #button = Button('click!')
    57         #win.add(button)
    52         #win.add(button)
    58         #button.x = 10
    53         #button.x = 10
    59         #button.y = 7
    54         #button.y = 7