3

Rather than giving you my entire code, most of which is completely unrelated to the problem, I'll show you the important bits:

from tkinter import *
root = Tk()
button = Button(root, text="Text", width=30, height=5)
button.pack()

root.mainloop()

It all works great, with the exception of one thing - the height of the button isn't being adjusted. Even the width enlarges when I set it to 30, but the height remains the same - the standard height of a button with size 12 font. Does anyone know why this is, or how to troubleshoot it?

I'm running OSX 10.11 on a Mac, with python 3.4. Any help is appreciated!

Bryan Oakley
  • 370,779
  • 53
  • 539
  • 685
Elle Nolan
  • 379
  • 5
  • 8
  • 22
  • @TigerhawkT3 what OS? – Elle Nolan Dec 20 '15 at 02:48
  • I am on Windows. It's possible that that option doesn't work on Mac (I've seen that happen once or twice before). – TigerhawkT3 Dec 20 '15 at 02:50
  • @TigerhawkT3 and people tell me Mac is better for software development. Thanks for your input. – Elle Nolan Dec 20 '15 at 03:06
  • It might be that Mac buttons simply don't support custom height values, like they don't support [custom bg/fg colors](http://stackoverflow.com/questions/1529847/how-to-change-the-foreground-or-background-colour-of-a-tkinter-button-on-mac-os). I'm not sure; I don't have a Mac to test this on. – TigerhawkT3 Dec 20 '15 at 03:12

1 Answers1

2

Tkinter on OSX won't allow you to change the height of a button. This is a limitation imposed by OSX in order to make sure all apps have a similar appearance.

This is one of the downsized to having native widgets on different platforms -- you are at the mercy of the platform limitations.

Bryan Oakley
  • 370,779
  • 53
  • 539
  • 685