Ad

How Can I Create MacOS' Help Button In Tkinter?

- 1 answer

The Human Interface Guidelines describe a distinctive Help button that isn't the same design as a normal tkinter button. My question is simply, can I create this button in tkinter? I looked in the tkinter docs on effbot, but couldn't find anything.

Ad

Answer

You can make a button, put a question mark image on it, and set borders to 0.

Here is an example:

from tkinter import *

root = Tk()
root.config(bg="light grey")
helpim = PhotoImage(file="help.gif")

help = Button(root, bd=0, bg="light grey")
help["activebackground"] = "light grey"
help.config(image=helpim)
help.pack()

root.mainloop()

This is the question mark image I used:

enter image description here

You can assign the button a command to show the help as a dialog message box.
Output:

enter image description here

Ad
source: stackoverflow.com
Ad