hoss
hoss

Reputation: 11

python tkinter on CentOS 8.1

Was trying to get an existing python/tkinter gui (from CentOS 7.4) running on CentOS 8.1 and the fonts were all really tiny, spent several hours trying to set default font sizes e.g. TkDefaultFont as follows:

  root = tk.Tk()

  default_font = font.nametofont("TkDefaultFont")
  default_font.configure(size=11)
  root.option_add("*Font", default_font)
  root.option_add('*Dialog.msg.font', default_font)

which was partially successful and got the window fonts back to normal - however 'system' dialogs e.g. messagebox or filedialog were still screwed up

See the answer below....

Upvotes: 0

Views: 216

Answers (1)

hoss
hoss

Reputation: 11

Turned out that the tk scaling factor was coming back as 'Inf' !?

The solution was to make a TK call to set the scaling factor to '1' - i.e. 1 pixel per point, and everything was back to normal. as follows:

  root = tk.Tk()

  root.tk.call('tk', 'scaling', '1')
  ...

Could not find any internet references to this issue

PS Using Virtualbox and 'server' or 'workstation' install of CentOS 8.1.1911

Upvotes: 1

Related Questions