Just a few comments based on YOUR script: #### from Tkinter import * class App: def __init__(master): self.frame=Frame(master) self.frame.pack() self.button=Button(self.frame,text="QUIT",fg="red",command=self.quit) self.button.pack(side=LEFT) self.hi_there=Button(frame,text="Hello",command=self.say_hi) self.hi_there.pack(side=LEFT) def say_hi(self): print "Hi there, everyone!" def quit(self): import sys sys.exit() if __name__ == "__main__": root=Tk() app = App(root) root.mainloop() ################# That should work... just some minor tweaking. "Brian & Colleen" <greybria at direct.ca> wrote in message news:3AD7647B.6A4B555B at direct.ca... | Is anyone willing to share the source for a small Tkinter app (maybe an | editor or file viewer) that includes a menu. I'm having problems getting | a menu to work inside an encapsulated application.#! /usr/bin/env python | | from Tkinter import * | | class App: | frame=Frame(master) | frame.pack() | | self.button=Button(frame,text="QUIT",fg="red",command=frame.quit) | self.button.pack(side=LEFT) | | self.hi_there=Button(frame,text="Hello",command=self.say_hi) | self.hi_there.pack(side=LEFT) | | def say_hi(self): | print "Hi there, everyone!" | | root=Tk() | app = App(root) | root.mainloop() | | Somewhere inside the App class, I'd like to include a basic menu | (File-Save As, Exit) etc. so that when I create an instance of App, all | the pieces are there. | | Thanks in advance. | | -- | Brian Smith | greybria at direct.ca | http://mypage.direct.ca/g/greybria | | |
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4