-1

Let's assume I have window with button as in code:

settings_window = tk.Toplevel()
settings_window.wm_title('Ustawienia')
grid = tk.BooleanVar()
c1 = tk.Checkbutton(settings_window, offvalue=False, onvalue=True, text="siatka", variable=grid, indicatoron=True).grid(row=0, column=0, sticky='W')

And how I can achieve situation when after start button will be signed:

Instead of being empty (not signed):

I tried to use:
state option with 'active', 'normal', and 'disabled',
indicatoron option with True,
and:
grid.set(True),
before CheckButton.
None of them helped.

martineau
  • 119,623
  • 25
  • 170
  • 301
Tomasz Wójcik
  • 61
  • 1
  • 1
  • 6

1 Answers1

0

grid.set(True) without any of those other extra options works fine for me:

import tkinter as tk

settings_window = tk.Toplevel()
settings_window.wm_title("Ustawienia")
grid = tk.BooleanVar()
grid.set(True)
c1 = tk.Checkbutton(
    settings_window,
    text="siatka",
    variable=grid,
).grid(row=0, column=0, sticky="W")

tk.mainloop()
AKX
  • 152,115
  • 15
  • 115
  • 172