score:7
That problem always was interesting to me. One way I found to fix it is by using the place
method instead of grid
:
import Tkinter
form = Tkinter.Tk()
errorArea = Tkinter.LabelFrame(form, text=" Errors ", width=250, height=80)
errorArea.grid(row=2, column=0, columnspan=2, sticky="E", \
padx=5, pady=0, ipadx=0, ipady=0)
errorMessage = Tkinter.Label(errorArea, text="")
# 1) 'x' and 'y' are the x and y coordinates inside 'errorArea'
# 2) 'place' uses 'anchor' instead of 'sticky'
# 3) There is no need for 'padx' and 'pady' with 'place'
# since you can specify the exact coordinates
errorMessage.place(x=10, y=10, anchor="w")
form.mainloop()
With this, the label is placed in the window without shrinking the labelframe.
score:0
Use the grid function immediately after declaring the Labelframe.
EX :
String_l = ttk.Labelframe(pw, text='String',width=100, height=408).grid(column=1, row=0, padx=4, pady=4,rowspan=2)
score:1
If you use a sticky value that sticks the widget to all four sides of its cell rather than just one side, it won't shrink when you put a small label widget in it.
Another option is to call errorArea.grid_propagate(False)
, which tells the grid area not to shrink or expand to fit its contents. This will often result in undesirable resize behavior, or at least require you to do a little extra work to get the right resize behavior.
Credit To: stackoverflow.com
Related Query
- How to prevent Tkinter labelframe size changes when an empty label is inserted
- How to size a Tkinter Checkbutton by pixels when there's no text but also no image?
- How to size a Tkinter Checkbutton by pixels when there's no text but also no image?
- Tkinter label widget not updating when text file changes
- Updating Label when variable changes in Tkinter
- How to prevent not responding of tkinter program when running a while loop
- How to update Tkinter label when reading from a text file
- How to make tab key to delete inserted text in entry when it passes to next entry window tkinter
- Tkinter Labelframe strange behavior : border color disappear when applying text in label
- How to automatically adjust the size of a tkinter window when filling widgets
- How to fix most recent Label gets cut off Python Tkinter when using scrollbar
- Tkinter update label when variable changes
- how to prevent tkinter from freezing when I click somewhere else?
- How to clear a label using tkinter when pressing a button?
- How to prevent tkinter window from closing when I close Windows command console
- How can I "reset" the size of a Window on Tkinter when using Notebook?
- How to prevent my server Tkinter app from freezing when clicking a button?
- how to prevent { } to show up when using space in a string in Tkinter
- How to set the size of a label inside a panel in tkinter - python
- Python - Tkinter button size changes when chaging the size of its font
- How to show value on tkinter label when calibration work going on
- How to close the empty tkinter window that pops up when I run my code
- How do I clear tkinter label display when I click on the buttons
- How to have Tkinter Label text change when after certain amount of time?
- How do I prevent Tkinter from crashing when my code loses internet
- How do I prevent images from moving downwards when they're replaced in a tkinter window?
- How to delete 1 label when adding another - python tkinter
- In tkinter, how to prevent Text widget from resizing when font is changed and set size for widget?
- Why do pythons tkinter grid buttons stretch when a label in the grid changes size?
- how to destroy previews label when the function call again in tkinter python
- When the size of label changes, the size of the window changes as well in tkinter, python
- How to make tkinter label updatable and how to submit the entry value when pressed enter
- tkinter - How to clear a label when button is clicked for second time?
- How can i make a tkinter Label not ajust the column size using Grid?
- How to stop Tkinter LabelFrame from growing when certain text is placed in it
- How to scale label font size inside a 'Toplevel' Tkinter Window?
- How to decrease the size of a label in tkinter python
- How do I get an event callback when a Tkinter Entry widget is modified?
- How to update the image of a Tkinter Label widget?
- How do I change the text size in a Label widget? (tkinter)
- How to get the Tkinter Label text?
- How to justify text in label in Tkinter
- How to change font and size of buttons and frame in tkinter using python?
- How to change the color of a Tkinter label programmatically?
- How to make a tkinter Label background transparent?
- When I use update() with tkinter my Label writes another line instead of rewriting the same text
- How to line left justify label and entry boxes in Tkinter grid
- How do I make a pop up in Tkinter when a button is clicked?
- How to handle, when tkinter window gets focus
- How to set the root window size to half of the screen width and height Python Tkinter
More Query from same tag
- what is shortest way to export what's in a tree view to an excel file
- Tkinter:Cant place image which imported from Pixmap inside text widget using button
- <Control-x> binding not working in tkinter text widget
- Python3 tkinter: showing images from the Internet on a label (urllib) does not work
- Widgets overriding their frame's background
- Button taking the entire frame even with pre-defined width and height
- Python tkinter find_overlapping tuple?
- Trying to update a 3D graphs coordinates with matplotlib
- Python 2.7 / Tkinter multiple frames and menu
- Binding a ttkCombobox when a Button is pressed - Python
- tkinter, csv file, auto update
- Creating Blank Images in Python (allowing pixel by pixel manipulation)
- integrate speech recognition and tkinter
- Tkinter Mainloop Unreachable
- Why is image not showing up
- Weird behavior with Tkinter and lambda in a loop?
- Tkinter Scrollbars with labels, canvas and frames
- How to set size and position of objects in Tkinter window always fit with any screen size?
- How to redirect multiprocessing pool function
- Python Tkinter GUI: 'Clear result' button does not work
- Tkinter in Python.. Tic Tac Toe Game.. Error With the Button!
- Button object not callable in the tkinter code
- Python - Multi Listbox to Entry box
- Want to display the value of function in a tkinter label
- Tkinter buttons not stacking on left
- Tkinter Text widget sometime doesn't register dead-keys (^ ` ")
- Change icon in a Matplotlib figure window
- Frame resizing issue in Tk/ttk python
- Python Tkinter: AttributeError: 'str' object has no attribute '_root' (Using Classes)
- This is the weirdest thing i have ever encountered in python (Tkinter module) , any help understanding it?
- How to make this program to displayed the result correctly
- Python 2.7 Tkinter: loop through labels to display data on new row
- Add Tkinter to AWS Lambda
- Find the closest previous mark in a Tkinter text widget
- how to add multiple blocks in tkinter - python