From a5fdf514ed77acd1ae4bf1c3442d750a921d8735 Mon Sep 17 00:00:00 2001 From: unknown Date: Sat, 28 Jul 2012 11:34:24 -0400 Subject: Added PyOhio2012 presentation source code --- pyohio2012/src/notebook.py | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 pyohio2012/src/notebook.py (limited to 'pyohio2012/src/notebook.py') diff --git a/pyohio2012/src/notebook.py b/pyohio2012/src/notebook.py new file mode 100644 index 0000000..326d0c7 --- /dev/null +++ b/pyohio2012/src/notebook.py @@ -0,0 +1,36 @@ +from tkinter import * +from tkinter.ttk import * + +class TkNotebook(): + def __init__(self, root): + + self.frame = Frame(root) + self.notebook = Notebook(self.frame) + + f1 = Frame(self.notebook, width=200, height=100) + f2 = Frame(self.notebook, width=200, height=100) + self.notebook.add(f1, text="Page 1") + self.notebook.add(f2, text="Page 2") + + self.label = Label(self.frame, text="A Notebook on the left") + + # Layout + self.frame.grid(row=0, column=0, sticky=(N, S, E, W)) + self.notebook.grid(row=0, column=0, sticky=(N, S, E, W)) + self.label.grid(row=0, column=1, sticky=(E,)) + + # Resize rules + root.columnconfigure(0, weight=1) + root.rowconfigure(0, weight=1) + self.frame.columnconfigure(0, weight=2) + self.frame.rowconfigure(0, weight=2) + + def quit(self): + self.frame.quit() + +if __name__ == '__main__': + root = Tk() + + app = TkNotebook(root) + + root.mainloop() \ No newline at end of file -- cgit v1.2.3