On 06/12/11 12:10, Mic wrote:
from tkinter import* import tkinter as tk
You only need one of these two lines, the second is probably best.
import os NUMBEROFCHAIRS=32 class ChooseDestinationWindow(Frame): def __init__(self,master): super(ChooseDestinationWindow,self).__init__(master) self.grid() self.create_different_destinations() def create_different_destinations(self): self.destination1=Button(self, text="Destination1",command=self.Destination1_function) self.destination1.grid() self.destination2=Button(self, text="Destination2") self.destination2.grid() self.destination3=Button(self,text="Destination3") self.destination3.grid()
OK, that should work except you haven't set the command value to the function that creates the seat booking window. You probabvly also want to set the filename here too.
def Destination1_function(self): class Seats_Destination1(tk.Button):
I see you are still defining your classes inside yoyur functions. It really is more normal (and useful) to define them all at the top level.
It also makes your functions easier to read!
class Destination1_Chairs(Frame):
This is the thing you want to call from your destination buttons. So create a method in the top level window that creates one of these objects.
root=Tk() root.title("Booking Window") app=Destination1_Chairs(root) root.mainloop() root=Tk() root.title("Choose your destination") root.geometry("900x200") app=ChooseDestinationWindow(root) root.mainloop()
And you still have multiple root objects and multiple mainloops. That's bad practice and it will bite you eventually. -- Alan G Author of the Learn to Program web site http://www.alan-g.me.uk/ _______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor