On OSX, buttons will not grow vertically. That platform has strict
requirements about the look of buttons.

On Mon, Aug 7, 2017 at 4:25 AM, Beinan Li <li.bei...@gmail.com> wrote:

> I found that the problem applies to Button, but not Label.
>
> Using
>
> root = tk.Tk()
> tk.Label(root, text="A", bg='green').pack(side=tk.LEFT, expand=tk.YES,
> fill=tk.Y) # align to the left-edge,
> tk.Label(root, text="B", bg='red').pack(side=tk.TOP, expand=tk.YES,
> fill=tk.BOTH)
> tk.Label(root, text="C", bg='blue').pack(side=tk.RIGHT, expand=tk.YES,
> fill=tk.NONE, anchor=tk.NE)
> tk.Label(root, text="D", bg='yellow').pack(side=tk.LEFT, expand=tk.NO,
> fill=tk.Y)
> tk.Label(root, text="E", bg='purple').pack(side=tk.TOP, expand=tk.NO,
> fill=tk.BOTH)
> tk.Label(root, text="F", bg='pink').pack(side=tk.TOP, expand=tk.NO,
> fill=tk.NONE)
> tk.Label(root, text="G", bg='green').pack(side=tk.BOTTOM, expand=tk.YES,
> fill=tk.Y)
> tk.Label(root, text="H", bg='red').pack(side=tk.TOP, expand=tk.NO,
> fill=tk.BOTH)
> tk.Label(root, text="I", bg='blue').pack(side=tk.RIGHT, expand=tk.NO)
> tk.Label(root, text="J", bg='yellow').pack(anchor=tk.SE)
> root.mainloop()
>
> I managed to get label.png as attached.
>
> Note that I forgot to add the button "F" in my previous example, but
> that's a trivial mistake that does not affect my point.
>
> Does it mean that currently Buttons cannot fill vertically no matter what?
>
> Thanks,
> Beinan
>
>
> On Mon, Aug 7, 2017 at 4:56 PM, Beinan Li <li.bei...@gmail.com> wrote:
>
>> Hello Tkinter,
>>
>> I was following a book example code as following:
>>
>> import Tkinter as tk
>> root = tk.Tk()
>> tk.Button(root, text="A").pack(side=tk.LEFT, expand=tk.YES, fill=tk.Y)
>> tk.Button(root, text="B").pack(side=tk.TOP, expand=tk.YES, fill=tk.BOTH)
>> tk.Button(root, text="C").pack(side=tk.RIGHT, expand=tk.YES,
>> fill=tk.NONE, anchor = tk.NE)
>> tk.Button(root, text="D").pack(side=tk.LEFT, expand=tk.NO, fill=tk.Y)
>> tk.Button(root, text="E").pack(side=tk.TOP, expand=tk.NO, fill=tk.BOTH)
>> tk.Button(root, text="G").pack(side=tk.BOTTOM, expand=tk.YES, fill=tk.Y)
>> tk.Button(root, text="H").pack(side=tk.TOP, expand=tk.NO, fill=tk.BOTH)
>> tk.Button(root, text="I").pack(side=tk.RIGHT, expand=tk.NO)
>> tk.Button(root, text="J").pack(anchor=tk.SE)
>> root.mainloop()
>>
>> I was expecting to get the result in the attached expected.png,
>> but got what shows in got.png.
>>
>> It seems that the fill option does not work as expected.
>> I tried with Python 2.7.13 on macOS Sierra.
>>
>> What am I missing here?
>>
>> Thanks,
>> Beinan
>>
>>
>
> _______________________________________________
> Tkinter-discuss mailing list
> Tkinter-discuss@python.org
> https://mail.python.org/mailman/listinfo/tkinter-discuss
>
>
_______________________________________________
Tkinter-discuss mailing list
Tkinter-discuss@python.org
https://mail.python.org/mailman/listinfo/tkinter-discuss

Reply via email to