Ok i got this figured out. It's important to create the canvas in a class that is subclassed from Frame.
kimmyaf wrote: > > I cannot get my canvas to show within my existing frame. I can only get > it to build it's own frame. Can someone help? As you can see i've tried a > number of different things so i have a lot of stuff commented out at the > bottom. attached is a picture of what my GUI looks like. I want the canvas > to show in the same frame as the address entries not seperately. Any help > is appreciated. I see a lot of examples on the web but they are all > building the canvas in their own frame. I need it in the other frame. > > > class App: > def __init__(self, master): > > self.master = master # store link to master window (or: > self.frame._root()) > self.frame = Frame(master) # make a frame with master as parent > self.frame.grid(row=0, column=0) # initiate drawing of frame in > master window > > # make a label > self.label = Label(self.frame, text="Massachusetts Bay Transit > Authority - Bus Locator", justify=LEFT, > font= ("Helvetica","16", "bold")) > self.label.grid(row=0, column=0, columnspan=4) > print self.label.cget("font") # what's my font? > > # make another label > self.label = Label(self.frame, text="Enter your current location", > justify=LEFT, > font= ("Helvetica","12")) > self.label.grid(row=1, column=0) > print self.label.cget("font") # what's my font? > > > #######################################TEXT FIELDS############## > # make address text entry field > self.entry_addr = StringVar() > self.entry = Entry(self.frame, width=25, > textvariable=self.entry_addr) > self.entry_addr.set("Address line 1") > > self.entry.grid(row=1, column=1) > > > # make City text entry field > self.entry_city = StringVar() > self.entry = Entry(self.frame, width=25, > textvariable=self.entry_city) > self.entry_city.set("City") > > self.entry.grid(row=2, column=1) > > > > # make State text entry field > self.entry_state = StringVar() > self.entry = Entry(self.frame, width=11, > textvariable=self.entry_state) > self.entry_state.set("State Abvtn") > > self.entry.grid(row=3, column=1) > > > > # make Zip text entry field > self.entry_zip = StringVar() > self.entry = Entry(self.frame, width=5, > textvariable=self.entry_zip) > self.entry_zip.set("zip") > > self.entry.grid(row=4, column=1) > > > > ###################################CANVAS####################### > # Tkinter cannot use a PIL Image directly, but we can make a > PhotoImage from it > #img = Image.open("Imgfolder\map.jpg") > > #define a new frame and put a text area in it > #self.imgframe=Frame(self.frame) > #self.text=Text(self.textframe,height=30, width=50,wrap=WORD) > #self.text.pack(side=LEFT, fill=BOTH) > > #tkinter_phimg = ImageTk.PhotoImage(i) # can do only after Tk()! > self.imgframe = Tkinter.Tk() > self.canvas = Tkinter.Canvas(self.imgframe, width=50, height=50) > #canvas.pack() > > http://old.nabble.com/file/p28323328/frames.jpg > -- View this message in context: http://old.nabble.com/Getting-a-canvas-within-an-existing-frame.-tp28323328p28359260.html Sent from the Python - tkinter-discuss mailing list archive at Nabble.com. _______________________________________________ Tkinter-discuss mailing list Tkinter-discuss@python.org http://mail.python.org/mailman/listinfo/tkinter-discuss