Reputation: 403
For any label, say Label
, I want to center it using sticky.
Therefore I tried,
Label.grid(column = 0, row = 0, sticky = 'center') #using tkinter
Which is wrong, so how would I get this right?
Upvotes: 1
Views: 1023
Reputation: 386285
Widgets by default are centered in a grid cell. You should not provide a value for the sticky
option, or you can provide an empty string, which will have the same effect.
Upvotes: 2
Reputation: 81
Hello I was able to solve this with the following.
Label.grid(row=0, column=0, sticky = tkinter.N + tkinter.S + tkinter.E + tkinter.W);
#The N, S, E, and W represent north, south, east, and west.
#if you import tkinter as tk, then this could look much cleaner
Upvotes: 1