SImon
SImon

Reputation: 17

How can I create MacOS' Help button in tkinter?

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.

Upvotes: 1

Views: 582

Answers (1)

Nouman
Nouman

Reputation: 7303

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

Upvotes: 3

Related Questions