-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
  • 112,593
  • 23
  • 157
  • 280
Tomasz Wójcik
  • 39
  • 1
  • 1
  • 4

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
  • 123,782
  • 12
  • 99
  • 138