J
James Ash
I'm writing a very simple and small Ptyhon/Tkinter application and I'm
having trouble getting the menus to appear correctly. Rather than a name
appearing on the menu bar, I see "()" instead. Clicking on these "()" does
nothing (other than changing the appearance of them to indicated they've
been pressed).
I'm using Python 2.2.3 on Win2K, using a release downloaded from one
of the Cygwin mirrors.
This is most likely a simple mistake on my part, but I can't find it. I'm new
to Python and Tkinter both.
Any help appreciated!
Jim
#! /usr/bin/env python
# $Id$
#
# File: timecard.py
import string
from Tkinter import *
class App:
def callback(self):
print "called the callback!"
def __init__(self, master):
frame=Frame(master)
master.title("Timecard, Implemented in Cygwin supplied Python!")
master.maxsize(1000, 400)
frame.pack()
self.b = Button(frame, text="Clock In", width=8, command=self.callback)
self.b.pack(side=LEFT, padx=2, pady=2)
self.b = Button(frame, text="Clock Out", width=8, command=self.callback)
self.b.pack(side=LEFT, padx=2, pady=2)
self.b = Button(frame, text="Report", width=8, command=self.callback)
self.b.pack(side=LEFT, padx=2, pady=2)
self.menubar = Menu(master)
self.filemenu=Menu(self.menubar)
self.filemenu.add_command(master, label="Exit", command=self.callback)
self.menubar.add_cascade(master, label="File", menu=self.filemenu)
master.config(menu=self.menubar)
root = Tk()
app = App(root)
root.mainloop()
having trouble getting the menus to appear correctly. Rather than a name
appearing on the menu bar, I see "()" instead. Clicking on these "()" does
nothing (other than changing the appearance of them to indicated they've
been pressed).
I'm using Python 2.2.3 on Win2K, using a release downloaded from one
of the Cygwin mirrors.
This is most likely a simple mistake on my part, but I can't find it. I'm new
to Python and Tkinter both.
Any help appreciated!
Jim
#! /usr/bin/env python
# $Id$
#
# File: timecard.py
import string
from Tkinter import *
class App:
def callback(self):
print "called the callback!"
def __init__(self, master):
frame=Frame(master)
master.title("Timecard, Implemented in Cygwin supplied Python!")
master.maxsize(1000, 400)
frame.pack()
self.b = Button(frame, text="Clock In", width=8, command=self.callback)
self.b.pack(side=LEFT, padx=2, pady=2)
self.b = Button(frame, text="Clock Out", width=8, command=self.callback)
self.b.pack(side=LEFT, padx=2, pady=2)
self.b = Button(frame, text="Report", width=8, command=self.callback)
self.b.pack(side=LEFT, padx=2, pady=2)
self.menubar = Menu(master)
self.filemenu=Menu(self.menubar)
self.filemenu.add_command(master, label="Exit", command=self.callback)
self.menubar.add_cascade(master, label="File", menu=self.filemenu)
master.config(menu=self.menubar)
root = Tk()
app = App(root)
root.mainloop()