Tkinter and grid: strange alignment with and without sticky option
Dr. David J. Ritchie, Sr.
djrassoc01 at mindspring.com
Wed Feb 20 11:24:41 EST 2002
Yes, I see the same thing. My Python version is:
Python 2.1.1 (#97, Aug 2 2001, 21:53:31) [CW PPC GUSI2 THREADS] on mac
The Tkinter is the one that came with the Python on the CDROM for
O'Reilly's "Learning Python"
as is the copy of Python.
Running a slightly modified version of the original poster's example
listed below,
I find that the non-sticky red Listbox is horizontally
misaligned by a small amount (probably 1 pixel)
from the following non-sticky
Entry box, the sticky blue Listbox
and the sticky Entry box.
---
from Tkinter import *
def main():
root = Tk()
Listbox(root, width = 20, relief = RIDGE, font = "Courier",
bg = "red").grid(row = 0)
Entry(root, width = 20, relief = RIDGE, font = "Courier") \
.grid(row = 1)
Listbox(root, width = 20, relief = RIDGE, font = "Courier",
bg = "blue").grid(row = 2, sticky = W)
Entry(root, width = 20, relief = RIDGE, font = "Courier") \
.grid(row = 3, sticky = W)
root.mainloop()
return
if __name__=="__main__":
main()
---
--D.
vtail wrote:
> 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:
> ----
>
> snip
> ---
>
> The code in if..else.. block only differs in whether or not we are
> using a "sticky = W" option
>
>
--
Dr. David J. Ritchie, Sr.
djrassoc01 at mindspring.com
http://home.mindspring.com/~djrassoc01/
More information about the Python-list
mailing list