5

I was looking to add a simple message box to a program and it looks like you can't adjust the font size in python 3. That's annoying but not too bad - I'll just make my own window and get over it. What I don't understand is why the font was adjustable in python 2 but is no longer adjustable in python 3?

Example message box in python 3:

import tkinter
from tkinter import *
from tkinter import messagebox

root = Tk()

def Help(self):
    messagebox.showinfo("Window title", "Sample text")

test_button = Button(root, text="Test Button", font=("Helvetica", 25), command=self.Help)
test_button.grid(row = 2, column =0)

root.mainloop()

Here is a question addressing font adjustment in python 2: Control Font in tkMessageBox

And here is a question addressing the lack of font adjustment in python 3: How to set font of a messagebox with Python tkinter?

Can anyone explain the apparent loss in functionality? Why would we lose this option in a seemingly improved version of python?

EDIT: It looks like the solution applied in Python 2 will work on Linux machines running python 3. The issue seems to be limited to Windows operating systems (tested on Windows 7 and Windows 10).

Jack Duane
  • 185
  • 3
  • 17
  • 1
    seems on Windows, the messagebox dialog is "native" https://stackoverflow.com/a/53705264/3353857 – caoanan Sep 17 '20 at 08:27

0 Answers0