Syntax highlighted version here.
#! /usr/bin/env python3
from tkinter import Tk, Frame, Canvas, Menu, Label, SUNKEN, BOTTOM, W, X
class root_win(Tk):
def __init__(self):
Tk.__init__(self)
def run(self):
self.build_window()
self.mainloop()
def build_window(self):
self.title('My prototype window')
self.build_menu()
self.build_statusbar()
self.resize()
def build_menu(self):
self.menu = Menu()
self.config(menu = self.menu)
self.m_file = Menu(self.menu)
self.m_file.add_command(
label='Quit', command = self.destroy)
self.menu.add_cascade(label='File', menu = self.m_file)
def build_statusbar(self):
self.statusbar = Label(borderwidth=1, relief=SUNKEN, anchor=W)
self.statusbar.config( text = 'Started..')
self.statusbar.pack(fill=X, side=BOTTOM)
def resize(self):
w, h = self.winfo_screenwidth(), self.winfo_screenheight()
self.geometry("%dx%d+0+0" % (w, h))
gui = root_win()
gui.run()
No comments:
Post a Comment