Buttons with line breaks don't display properly on Mac OS X
This code works fine in Windows. On Mac OS X it only shows "Multiple" in the button and everything past the newline gets wiped out. I'm running Python 2.6.5 on Mac.
import Tkinter as tk
class App:
def __init__(self, master):
self.a_button = tk.Button(master, text="Multi开发者_StackOverflow中文版ple\nLines\nOf Text")
self.a_button.pack()
ROOT = tk.Tk()
APP = App(ROOT)
ROOT.mainloop()
Mac native pushbuttons don't let you do that; they have 3 predefined heights for the various control sizes and that's it. Other button styles do support arbitrary dimensions; one option is to use a Tile button instead:
self.a_button = tk.Widget(master, 'ttk::button',
dict(text="Multiple\nLines\nOf Text"))
精彩评论