-1

I tried looking it up but I couldn't find anything. I just want a frame, or a canvas, to have the same size as the main window, and whenever the window is expanded, the frame will also expand. I tried different options but they did not work. Is there any attribute I should add for my frame object below for it to have the same size as the root window?? Please help!

from tkinter import *

root = Tk()

fr = Frame(root, bg = "red")
fr.pack()

root.mainloop() 
Philip Kroup
  • 47
  • 1
  • 2
  • 8
  • Try this: http://stackoverflow.com/questions/22835289/how-to-get-tkinter-canvas-to-dynamically-resize-to-window-width – yuvalhuck Jan 21 '17 at 16:59

1 Answers1

5

In my personal GUI in tkinter I need a windows that appears fullscreen-sized. Than if you want to fill and expand your frame in the windows you have to use the fill and expand options of .pack method. In your case you can try with this code:

from tkinter import *

root = Tk()
root.state('zoomed')
fr = Frame(root, bg = "red")
fr.pack(expand=1, fill=BOTH)

root.mainloop()
Ad87F
  • 72
  • 1
  • 5