Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #75729

Tkinter menu crash

Newsgroups comp.lang.python
Date 2014-08-05 05:15 -0700
Message-ID <1a31faea-eea6-4b1d-8dc1-185f13348621@googlegroups.com> (permalink)
Subject Tkinter menu crash
From Nicholas Cannon <nicholascannon1@gmail.com>

Show all headers | View raw


Ok so the first part of the program(until the start of the menu) worked fine. It ran and did what I wanted it to do. I wanted to then implement a new menu(for practise) and then it crashes. Don't know why but it just crashes. (also tips on the code will be appreciated and I gave just started Tkinter programming)

Here is the code:


from Tkinter import *
import tkMessageBox as tm

def submit():
    #message box with yes no 
    tm.askyesno(title='Submit Text', message='Are you sure....')
    
def info():
    tm.showinfo(title='About', message='Just a test Tkinter UI sample')
    

    #getting the text from the entrybox and
    #packs it into a label
    mtext = text.get()
    label1 = Label(app, text=mtext)
    label1.pack()
    
#root window setup
root = Tk()
root.geometry('480x480+200+200')
root.title('Basic Tk UI')

#frame set up
app = Frame(root)
app.pack()

#variable and entry box set up
text = StringVar()
entry = Entry(app, textvariable=text)
entry.pack()

#button set up
button1 = Button(app, text='Submit text', command= submit)
button1.pack()

#menu construction
menubar = Menu(root)

filemenu = Menu(menubar)
filemenu.add_command(label='About', command= info)
filemenu.add_command(label='Quit', command= root.destroy)
filemenu.add_cascade(label='TK UI Sample', menu=filemenu)

root.config(menu=menubar)



#loop to listen for events
root.mainloop()

Back to comp.lang.python | Previous | NextNext in thread | Find similar | Unroll thread


Thread

Tkinter menu crash Nicholas Cannon <nicholascannon1@gmail.com> - 2014-08-05 05:15 -0700
  Re: Tkinter menu crash Terry Reedy <tjreedy@udel.edu> - 2014-08-05 17:43 -0400
    Re: Tkinter menu crash Nicholas Cannon <nicholascannon1@gmail.com> - 2014-08-05 15:28 -0700
      Re: Tkinter menu crash Terry Reedy <tjreedy@udel.edu> - 2014-08-05 19:27 -0400
        Re: Tkinter menu crash Nicholas Cannon <nicholascannon1@gmail.com> - 2014-08-05 16:33 -0700
          Re: Tkinter menu crash Terry Reedy <tjreedy@udel.edu> - 2014-08-06 00:13 -0400

csiph-web