![]() |
|
[Tkinter] Frame size only works if frame is empty(Solved) - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: Python Coding (https://python-forum.io/forum-7.html) +--- Forum: GUI (https://python-forum.io/forum-10.html) +--- Thread: [Tkinter] Frame size only works if frame is empty(Solved) (/thread-7909.html) |
Frame size only works if frame is empty(Solved) - Tuck12173 - Jan-29-2018 I am trying to have a set frame size so I can place my widgets where I like them but the frame only seems to give me my dimensions when I comment out the widgets. Just a heads up I am teaching myself all of this for work. from tkinter import *
import openpyxl
from PIL import ImageTk, Image
wb = openpyxl.load_workbook('test.xlsx')
ws = wb['Customer']
ws1 = wb['Invoice']
d = ws['D8'].value
rnginv = ws1['AA4'].value
root = Tk()
frame = Frame(width=1350, height=900)
frame.pack()
photo = ImageTk.PhotoImage(Image.open('DelusionalDesignslogo2.png'))
logo = Label(frame, image=photo)
logo.pack()
titleA = Label(frame, text=d)
titleA.pack()
labelrinv = Label(frame, text=rnginv)
labelrinv.pack()
root.wm_title('Delusion Designs CNC Invoice Program v1.0')
root.mainloop()Thanks for any help I get.Tuck RE: Frame size only works if frame is empty - Larz60+ - Jan-29-2018 try adding: frame.pack_propagate(False)after calling pack RE: Frame size only works if frame is empty - Tuck12173 - Jan-29-2018 Thank you but that did not work. Tuck RE: Frame size only works if frame is empty - Larz60+ - Jan-29-2018 The other thing you can do, when packing, is add fill=Both, expand=True like: frame.pack(fill=Both, expand=True) RE: Frame size only works if frame is empty - Tuck12173 - Jan-29-2018 I get this error. Traceback (most recent call last): File "C:/Users/Delusional Customer/PycharmProjects/DelusionalDesignsCNC/Invoice.py", line 14, in <module> frame.pack(fill=Both, expand=True) NameError: name 'Both' is not defined Changed to "BOTH" and I am back at the original problem. Window still only resizes if empty, RE: Frame size only works if frame is empty - Larz60+ - Jan-29-2018 then use tkinter.BOTH don't place in quotes RE: Frame size only works if frame is empty - Tuck12173 - Jan-29-2018 I just put quotes there to show what I changed. RE: Frame size only works if frame is empty - Larz60+ - Jan-29-2018 did you try tkinter.BOTH ? |