Good day.
I am attempting to create an options selection menu for a school assignment.
I am using the Python 3.7.2 Themed Tkinter library in order to display this program properly. However, I am having some issues getting my ttk.Checkbutton() widgets to display appropriately. However, while the Checkbutton() is set to be unchecked by default, it is displaying a black square within the button. I have confirmed that this black square represents a false value, as when I click it it displays the true check. When I uncheck it, however, it becomes blank rather than returning to the black square state. I have checked this issue with both BooleanVar() and IntVar() values, with the same issue.
Here is an excerpt from the code, which is functional:
from tkinter import *
from tkinter import ttk
root = Tk()
root.title("Order Manager")
menu__pizza_1_count = IntVar()
menu__pizza_1_count.set(0)
menu__pizza_1_cheese = BooleanVar()
menu__pizza_1_cheese.set(False)
menu__pizza_1_bacon = BooleanVar()
menu__pizza_1_bacon.set(False)
menu__pizza_1_label = ttk.Label(root, text="A Shrubbery")
menu__pizza_1_label.grid(row=0, column=0, columnspan=2, padx=5, pady=5)
menu__pizza_1_price = ttk.Label(root, text="$8.50")
menu__pizza_1_price.grid(row=1, column=0, columnspan=1, padx=5, pady=5)
menu__pizza_1_current = ttk.Label(root, textvariable=menu__pizza_1_count)
menu__pizza_1_current.grid(row=1, column=1, padx=5, pady=5)
menu__pizza_1_cheese = ttk.Checkbutton(root, text="Cheese", variable=menu__pizza_1_cheese, offvalue=False, onvalue=True)
menu__pizza_1_cheese.grid(row=2, column=0, pady=5)
menu__pizza_1_bacon = ttk.Checkbutton(root, text="Bacon", variable=menu__pizza_1_bacon, offvalue=False, onvalue=True)
menu__pizza_1_bacon.grid(row=2, column=1, pady=5)
menu__pizza_1_increase = ttk.Button(root, width=7, text="+") #add count COMMAND
menu__pizza_1_increase.grid(row=3, column=0, padx=5, pady=5)
menu__pizza_1_decrease = ttk.Button(root, width=7, text="-") #decrease count COMMAND
menu__pizza_1_decrease.grid(row=3, column=1, padx=5, pady=5)
[This is what the end result looks like on my end][1]
Does anyone have any suggestions on how to get it do display as blank by default?
Regards, Elliott [1]: https://i.stack.imgur.com/DfzMT.png
You checkbox name in the same as the variable name. If you use different names, the checkboxes work correctly.
Startup Output