Tkinter and grid: strange alignment with and without sticky option
vtail
vtail at yandex.ru
Tue Feb 12 11:02:25 EST 2002
Hi, guys,
I have very odd problem with using grid() with and without sticky
option. Here is my python version:
Python 2.2 (#28, Dec 21 2001, 12:21:22) [MSC 32 bit (Intel)] on win32
I'm using Tkinter that ships with standard distribution.
Consider the following snipet:
----
from Tkinter import *
def main(is_sticky = 0):
root = Tk()
if is_sticky:
Listbox(root, width = 20, relief = RIDGE, font = "Courier",
bg = "white").grid(row = 0, sticky = W)
Entry(root, width = 20, relief = RIDGE, font = "Courier") \
.grid(row = 1, sticky = W)
else:
Listbox(root, width = 20, relief = RIDGE, font = "Courier",
bg = "white").grid(row = 0)
Entry(root, width = 20, relief = RIDGE, font = "Courier") \
.grid(row = 1)
root.mainloop()
if __name__=="__main__":
main(1)
---
The code in if..else.. block only differs in whether or not we are
using a "sticky = W" option
When running main(0), all is OK. But when running main(1), I see
Listbox moved one pixel to the right.
It all seems very strange for me. Does anybody has any ideas? I really
need your help.
Thanks a lot,
Vtail.
More information about the Python-list
mailing list