Menu development. New focus. Easier imports from tuikit package.
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import locale
locale.setlocale(locale.LC_ALL, '')
from tuikit import *
class MyApplication(Application):
def __init__(self):
Application.__init__(self)
self.top.connect('keypress', self.globalkeypress)
menubar = MenuBar()
self.top.add(menubar)
win = Window()
self.top.add(win)
win.x = 10
win.y = 5
win.allowlayout = False
filemenu = Menu([
('New', None),
None,
('Open', None),
('Save', None),
None,
('Quit', self.terminate),
])
self.top.add(filemenu)
editmenu = Menu([('Copy', None), ('Paste', None)])
helpmenu = Menu([('About', None)])
self.top.add(editmenu)
self.top.add(helpmenu)
menubar.setitems([
('File', filemenu),
('Edit', editmenu),
('Help', helpmenu),
])
vert = VerticalLayout()
self.top.layout(vert)
#button = Button('click!')
#win.add(button)
#button.x = 10
#button.y = 7
#button.connect('click', self.buttonclick)
#self.button = button
#subwin = Window(8,8)
#win.add(subwin)
def globalkeypress(self, keyname, char):
if keyname == 'escape':
self.terminate()
if __name__ == '__main__':
app = MyApplication()
app.start()