Tkinter: grid() resize

Solved
modefee -  
 modefee -
Hello,
I built a Python interface arranged with place().
As a project improvement, I plan to place all my elements with grid().
I'm having a problem with the size of my entry elements which I had formed as large squares in the window but I can't resize my entries with grid() except by changing the font size. Stretching it across multiple columns or rows doesn't work. How else can I do it?

5 answers

Phil_1857 Posted messages 1883 Registration date   Status Member Last intervention   169
 
Hello,

We would have a clearer view if you displayed your code here, and with code tags:
https://codes-sources.commentcamarche.net/faq/11288-les-balises-de-code
0
modefee
 
Here is my translation of your code block into English, preserving structure and HTML tags:
 import tkinter as tk from tkinter import * screen1 = Tk()# definition of the window screen1.geometry('1200x700') # window size screen1.title('Draft')# window title screen1.configure(bg='#F2E7BF') # default window color screen1.resizable(width=True, height=True)# allows resizing of the window Button = Button(screen1, text="Button",relief=RAISED,background="#FFC24B",foreground="white") # button that calls the getEntry function Button.grid(row=0,column=0) paragraph= Label(screen1,text="text ") # text paragraph.grid(row=1, column =18, rowspan=1, columnspan= 8) scrollbar = Scrollbar(screen1, orient=HORIZONTAL) # user input scrollbar.grid(row=5, column=8, columnspan=10 ) myEntry = Entry(screen1, xscrollcommand=scrollbar.set) # user input myEntry.grid(row=0, column = 6, rowspan= 5, columnspan=5) myEntry.config(font='arial 24') scrollbar.config(command= myEntry.xview) screen1.mainloop()# loop to keep the window open. 
0
Phil_1857 Posted messages 1883 Registration date   Status Member Last intervention   169
 
Hello,
 # button that calls the getEntry function Button = Button(screen1, text="Bouton", relief=RAISED, background="#FFC24B", foreground="white")


Your button does not call any function, to call a function with a button, you must write:
Bouton = Button(screen1, text="Bouton", relief=RAISED, background="#FFC24B", foreground="white", command = nom_de_la_fonction)


Where is the getEntry function???

Otherwise, for the size of an Entry, it’s more like this, with ipadx, ipady:
 myEntry.grid(row=0, column = 6, rowspan= 5, columnspan=5, ipady = 10) 


Line 1 is useless ...
0
Phil_1857 Posted messages 1883 Registration date   Status Member Last intervention   169
 
screen1.mainloop()# loop that keeps the window open.


No, it is the event wait loop (button press, input in an Entry, ...)
since we are in event-driven programming
0
modefee
 
I tried with ipadx and ipady and I indeed managed to modify the size of the entry. Thank you very much.
Thanks for the other recommendations. I didn’t want to re-add the entire code, so I removed the button commands to keep only the elements to place and thus be able to run it again.
0