Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Button text of tkinter does not work in mojave

Tags:

It is very simple program.

import tkinter
tkinter.Button(None, text='button').pack()
tkinter.mainloop()

I expect this program shows me such as a below picture.
work well

But it shows a below picture actually.
not work

When it is resized on GUI it seems working well.

It didn't occur this problem in High Sierra.

My environment is following:

  • macOS Mojave 10.14
  • Python 3.7.0

Could you advice to me?

I found out same problem on here.

like image 692
Tiger Avatar asked Sep 27 '18 04:09

Tiger


People also ask

Does Python Tkinter work on Mac?

Tkinter is a graphical user interface (GUI) module for Python, you can make desktop apps with Python. You can make windows, buttons, show text and images amongst other things. Tk and Tkinter apps can run on most Unix platforms. This also works on Windows and Mac OS X.

Why is my Tkinter not working?

The easiest way to fix this problem is by upgrading your python to use python 3. If upgrading python is not an option, you only need to rename your imports to use Tkinter (uppercase) instead of tkinter (lowercase). Output: As a result, this window proves that your python installation includes the Tkinter module.

What is BD in button Tkinter?

Tkinter Button bd option sets width or stroke of the border around the outside of the button. In this tutorial, we will learn how to use bd (border) option and change the width of the border for button.


2 Answers

Changing Appearance to Light Mode fixed this problem for me.

To change appearance, go to Settings -> General -> Appearance -> Light Mode.

Dark Mode

Light Mode

like image 111
Pratik Kulkarni Avatar answered Sep 19 '22 01:09

Pratik Kulkarni


I guess there is a bug in Tk. I am on MacOS 10.14.3 If you maximize and minimize the tkinter window the text on the button appears, another solution that worked for me is

from tkinter import *
from tkinter import ttk

button1 = ttk.Button(*your args here*)
like image 28
Xabnord Avatar answered Sep 21 '22 01:09

Xabnord