logo
down
shadow

Python TKinter: frame and canvas will expand horizontally, but not vertically, when window is resized


Python TKinter: frame and canvas will expand horizontally, but not vertically, when window is resized

By : chen ying
Date : November 21 2020, 07:35 AM
Hope that helps It is because you give row 0 of AllValOuterFrame a weight of 1, but you put the canvas in row 1. If you move the canvas to row 0 or give row 1 a weight of 1, it will resize the way you expect.
code :


Share : facebook icon twitter icon
WPF - Maximizing app window does not expand controls vertically - horizontally it does

WPF - Maximizing app window does not expand controls vertically - horizontally it does


By : kwas
Date : March 29 2020, 07:55 AM
hop of those help? FYI. I ended up changing the Height of the grid to "Auto", and then when the SizeChanged event for the Window1 fired, I set the grid Height to the e.NewSize.Height minus the ActualHeights of the controls in the StackPanel that are above it. Not how I would like it to be, but so far the only solution I found that works.
.
Tkinter, Canvas refuses to expand or contract when window resized

Tkinter, Canvas refuses to expand or contract when window resized


By : Naveen
Date : March 29 2020, 07:55 AM
This might help you I'm trying to make my canvas expand and contract based on window size, with scrollbars as necessary. I have not added the horizontal scrollbars yet, but it scales neither horizontally nor vertically, instead stubbornly remaining at an arbitrary size. , You need to configure the outer-most grid layout, too.
code :
...
root = Tk()
root.columnconfigure(0, weight=1)
root.rowconfigure(0, weight=1)
...
root = Tk()
frame = ttk.Frame(root)
frame.pack(expand=1, fill=BOTH)

maxtick = 1000

inner_frame = ttk.Frame(frame)
inner_frame.pack(expand=1, fill=BOTH, side=LEFT)

# Primary canvas (inner_frame)
canvas = Canvas(inner_frame, bg='#FFF', width=maxtick,
                scrollregion=(0, 0, maxtick, 16 * (128 + 1 + 1)) )
canvas.pack(expand=1, fill=BOTH)

for y in range(1, 128 + 1 + 1):
    canvas.create_line(0, 16 * y - 1, maxtick, 16 * y - 1)

# Vertical scrollbar
vbar = ttk.Scrollbar(frame, orient=VERTICAL, command=canvas.yview)
vbar.pack(fill=Y, side=LEFT)
canvas.configure(yscrollcommand=vbar.set)

root.mainloop()
Tkinter: How to get frame in canvas window to expand to the size of the canvas?

Tkinter: How to get frame in canvas window to expand to the size of the canvas?


By : SilverGekko
Date : March 29 2020, 07:55 AM
may help you . Set a binding on the canvas event, which fires whenever the canvas changes size. From the event object you can get the canvas width and height, and use that to resize the frame.
How to center widgets vertically and horizontally in window with Tkinter?

How to center widgets vertically and horizontally in window with Tkinter?


By : e1000iodh
Date : March 29 2020, 07:55 AM
Does that help I think that in this case you can simply use a Frame widget as the parent of the labels and then pack the frame by setting the expand option to True:
code :
from tkinter import *


root = Tk()

root.geometry("200x200")
root.title("Question 2")
root.configure(background="green")

parent = Frame(root)
Label(parent, text = "RED", fg="red", bg="black").pack(fill="x")
Label(parent, text = "WHITE", fg="white", bg="black").pack(fill="x")
Label(parent, text = "BLUE", fg="blue", bg="black").pack(fill="x")
parent.pack(expand=1)  # same as expand=True

root.mainloop()
Python Tkinter : Area of Scrollbar Frame Window Expand Vertically when main window is resized

Python Tkinter : Area of Scrollbar Frame Window Expand Vertically when main window is resized


By : Alex Blackburn
Date : March 29 2020, 07:55 AM
it fixes the issue I'm not entirely what you mean by "frame window" -- those terms are mutually exclusive. A frame is a widget that is in a window. I'm going to assume you want the frame full of widgets to expand.
You have a couple of problems working against you. The first is that you're putting the canvas in a frame, but you haven't configured the frame to expand. If the frame doesn't expand, the canvas can't either.
code :
myframe.pack(side="top", fill="both", expand=True, padx=10, pady=10)
myframe.place(x=10,y=10, relwidth=1.0, relheight=1.0, width=-20, height=-20)
canvas.pack(side="left", fill="both", expand=True)
Related Posts Related Posts :
  • Filtering from data
  • Where is the problem about selenium with python?
  • ansible custom filter fails when importing python library
  • How to assign the label of one column to the new one based on group maximum in pandas
  • What is the best approach for isolating a single area of similar colour?
  • Creating multiple clients for topics
  • Why is my 'for loop', despite iterating over all keys, only acting on the last one?
  • Can someone tell me what's wrong, when I run it the browsers says "This site can’t be reached"
  • Error in setting up mitmproxy on alpine 3.9
  • From traditional loop to list comprehension
  • Django celery unregistered task | relative imports
  • How to add elements in a multi dimensional array
  • Async await with sqs receive messages not working properly
  • What is definition of 'NAME' in Python grammar
  • Easy method to move rows from df to another with coditions?
  • Changing the size of only a single plot in matplotlib, without altering figure parameters
  • Fastest way to use Vision API on 10,000+ images with python
  • How to install nvidia apex on Google Colab
  • Random numbers Continuous in python
  • Fetching data after a certain time interval(10 sec) from a continuously increasing database like mysql using flask
  • Using VLOOKUP with merge in Python
  • Calculate geographical distance between 5 cities with all the possible combinations of each city
  • How to filter a pandas dataframe using multiple partial strings?
  • Pygame- make bullet shoot toward cursor direction
  • Create SEQUENCE based dictionary from list
  • How to fix broken link from Django MEDIA_ROOT?
  • How can I display the current time left in a timer in a label?
  • Compute number of occurance of each value and Sum another column in Pandas
  • How to separate the prefix in words that are 'di'?
  • Handling network errors from an external API across an application
  • Want a pandas Series of Trips Completed to count(Request) ratio for each hour as index for the given dataframe
  • Access dict keys and list elements by same index to loop over and assign values
  • Find rows from the same dataframe based on condition
  • Read only specific part first two lines from text file in python
  • Python How to convert string to dataframe?
  • How to fix this my error code program? I use Python 3.6
  • Is there a way of getting this string down to 3 words?
  • Large difference between overall F Score for a custom Spacy NER model and Individual Entity F Score
  • Drop rows where timestamps are older than subsequent row
  • Implement a bottle spin
  • Unable to convert widows epoch time to normal date time
  • Values from a XML file
  • PyAudio readframes not ending when wav file completes
  • Could not load the module
  • How to change datetime.datetime(2012, 1, 1, 0, 0) to 1/1/2012 in Python?
  • How to create ASN.1 Sequence without NamedType?
  • How to locate specific sequences of words in a sentence efficiently
  • How can I generate a multi-step process in Django without changing pages (w/out a new request)?
  • Why does this list comprehension only "sometimes" work?
  • send html report with row collapsed
  • How to define a type hint to a argument (the argument's value is a class, all expected value is a subclass of a certain
  • How do I send a styled pandas DataFrame by e-mail without losing the format?
  • How to view/average a groupby dataframe when the data is a string?
  • Django 2.2 staticfiles do not work in development
  • Flag to enable/disable numba JIT compilation?
  • Trying to split byte in a byte array into two nibbles
  • Error in Query - missing FROM-clause entry for table - SQL
  • Reading double c structures of Dll with Ctypes in Python
  • Autofill missing row in database based on missing time range
  • Get the max of a nested dictionary
  • shadow
    Privacy Policy - Terms - Contact Us © festivalmusicasacra.org