Hello,

 I am a newbie in the field of python. I want to create a wizard using 
python language. in which i am creating some buttons to open another 
frame and closing the parent frame. Right now i am facing problems in 
passing arguments from one frame to another frame. for example to 
dispose current frame i use frame1.destroy but am not able to navigate. 
Here is the code.........

import os, sys
from Tkinter import *
from ImageTk import PhotoImage           # <== use PIL replacement class

                                         # rest of code unchanged
imgdir  = 'images'
imgfile = 'sevasys1.jpg'
icon= 'sevasys2.ico'
imgpath = os.path.join(imgdir, imgfile)
icopath = os.path.join(imgdir, icon)
x0=0
y0=0
xoff=200
yoff=80
xhor=600
yver=450
class Application(Frame):
     def __init__(self, master,my):
            """ Initialize the frame. """
            my=Frame.__init__(self, master)
            my.pack()
            my.create_frame1()           
     def create_frame1(self):
            frame1=Frame(self)
            frame1.pack()
            frame1.imgobj = PhotoImage(file=imgpath)       # now JPEGs work!
            c = Canvas(frame1, width=xhor, bg='white', height=yver-70)
            c.grid(row=0,column=0)
            c.create_line(x0, yver-70, xhor, yver-70)
            c.create_line(x0, yver-72, xhor, yver-72)
            c.create_image(x0,y0,image=frame1.imgobj,anchor=NW)
            c.create_text(x0+350,y0+50,text='Welcome to SSM 0.0.001 
Wizard', fill='Black', font=('verdana', 15), anchor=N)
            c.create_text(x0+350,y0+100,text='The Support Wizard will 
help you in troubleshooting \nnetwork related problems. Click Next to 
\ncontinue or Cancel to exit Support Wizard', fill='Black', 
font=('verdana', 10), anchor=N)
            bttn_cancel = Button(text='Cancel', command=sys.exit, 
underline=0)
            bttn_cancel.config(font=('verdana', 12))
            bttn_cancel.pack(side=RIGHT, anchor=E,padx=18)
            bttn_next = Button(text='Next', command=self.create_frame2, 
underline=0)
            bttn_next.config(font=('verdana', 12))
            bttn_next.pack(side=RIGHT, ipadx=10,anchor=E)
            bttn_back = Button(text='Back', underline=0)
            bttn_back.config(font=('verdana', 12),state=DISABLED)
            bttn_back.pack(side=RIGHT, ipadx=10,anchor=E)
            frame1.destroy()
     def create_frame2(self):
            self.frame1.destroy()
##            self.destroy()
            frame2=Frame(self)
            frame2.pack()
            frame2.imgobj = PhotoImage(file=imgpath)       # now JPEGs work!
            c = Canvas(frame2, width=xhor, bg='white', height=yver-70)
            c.grid(row=0,column=0)
            c.create_line(x0, yver-70, xhor, yver-70)
            c.create_line(x0, yver-72, xhor, yver-72)
            c.create_image(x0,y0,image=frame2.imgobj,anchor=NW)
            c.create_text(x0+350,y0+50,text='Welcome to SSM 0.0.001 
Wizard', fill='Black', font=('verdana', 15), anchor=N)
            c.create_text(x0+350,y0+100,text='The Support Wizard will 
help you in troubleshooting \nnetwork related problems. Click Next to 
\ncontinue or Cancel to exit Support Wizard', fill='Black', 
font=('verdana', 10), anchor=N)
            frame2.bttn_cancel = Button(text='Cancel', command=sys.exit, 
underline=0)
            frame2.bttn_cancel.config(font=('verdana', 12))
            frame2.bttn_cancel.pack(side=RIGHT, anchor=E,padx=18)
            frame2.bttn_next = Button(text='Next1', underline=0)
            frame2.bttn_next.config(font=('verdana', 12))
            frame2.bttn_next.pack(side=RIGHT, ipadx=10,anchor=E)
            frame2.bttn_back = Button(text='Back', underline=0)
            frame2.bttn_back.config(font=('verdana', 12),state=DISABLED)
            frame2.bttn_back.pack(side=RIGHT, ipadx=10,anchor=E)
##            app2.__init__(self)
##            app2.create_widget(self)

##class Application2(Application):
## def __init__(self):
##        """ Initialize the frame. """
##        Frame.__init__(self)
##        self.pack()
##        self.create_widget()
## def create_widget(self):
##        self1.imgobj = PhotoImage(file=imgpath)       # now JPEGs work!
##        c = Canvas(self, width=xhor, bg='white', height=yver-70)
##        c.grid(row=0,column=0)
##        c.create_line(x0, yver-70, xhor, yver-70)
##        c.create_line(x0, yver-72, xhor, yver-72)
##        c.create_image(x0,y0,image=self.imgobj,anchor=NW)
##        c.create_text(x0+350,y0+50,text='Welcome to SSM 0.0.001 
Wizard', fill='Black', font=('verdana', 15), anchor=N)
##        c.create_text(x0+350,y0+100,text='The Support Wizard will help 
you in troubleshooting \nnetwork related problems. Click Next to 
\ncontinue or Cancel to exit Support Wizard', fill='Black', 
font=('verdana', 10), anchor=N)
##        bttn_cancel = Button(text='Cancel', command=sys.exit)
##        bttn_cancel.config(font=('verdana', 12))
##        bttn_cancel.pack(side=RIGHT, anchor=E,padx=18)
##        bttn_next = Button(text='Next')
##        bttn_next.config(font=('verdana', 12))
##        bttn_next.pack(side=RIGHT, ipadx=10,anchor=E)
##        bttn_back = Button(text='Back')
##        bttn_back.config(font=('verdana', 12),state=DISABLED)
##        bttn_back.pack(side=RIGHT, ipadx=10,anchor=E)
##class Application2(Canvas):
##
## def __init__(self, master):
##    """ Initialize the frame. """
##    Canvas.__init__(self, master)
##    self.create_w()
##
## def create_w(self):
##     y=self.create_text(11,22,text="Welcome to the SevaSys support")
##     x=self.create_line(0,150, 50,100, 0,50, 50,0,smooth=1)

root = Tk()
root.title("SevaSys Support Module v 0.0.001")
root.geometry(str(xhor)+"x"+str(yver)+"+"+str(xoff)+"+"+str(yoff))
root.resizable(0,0)
root.iconbitmap('sevasys2.ico')
app = Application(root)
##app2 = Application2(root)
root.mainloop()


any help will be appreciated

thanks and regards

Surya Prakash Garg

-- 
This message has been scanned for viruses and dangerous content 
by SevaSecure Mail Service, and is believed to be clean.

_______________________________________________
Tkinter-discuss mailing list
Tkinter-discuss@python.org
http://mail.python.org/mailman/listinfo/tkinter-discuss

Reply via email to