Python Forum
[closed] "checked" variable (attribute?) origin?
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[closed] "checked" variable (attribute?) origin?
#2
Are you wondering wy button.clicked passes 1 argument (self) to "the_button_was_clicked" and two arguments to "the_button_was_toggled"?

I think your grabbed that snippet from here.
https://www.pythonguis.com/tutorials/pys...ts-events/

But this has a better description of signals and slots and how they relate to your particular example.
https://doc.qt.io/qtforpython-6.5/tutori...slots.html

The cliff notes version is the QPushButton.clicked signal has information about the toggled state of the button, even if the button cannot be toggled. When the clicked signal called "the_button_was_clicked()" the toggle state was not passed. When clicked signal called "the_button_was_toggled()", it passes the toggle state as a function argument. It knew to do this by inspecting the signature of the callback function.
Reply


Messages In This Thread
RE: "checked" variable (attribute?) origin? - by deanhystad - Feb-28-2024, 04:26 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  tkinter checkbutton if checked MC2020 2 6,130 Jan-21-2020, 07:08 PM
Last Post: joe_momma
  [Tkinter] Extrakt a Variable from a closed tkinter window hWp 5 3,986 Aug-23-2019, 09:01 PM
Last Post: woooee
  [WxPython] how to reopen a closed tab of wx.aui.Notebook? royer14 2 3,395 Feb-18-2019, 12:31 AM
Last Post: royer14
  [Tkinter] Completing Action when CheckBox is Checked Anysja 2 8,117 Aug-02-2018, 04:38 PM
Last Post: Anysja
  [Tkinter] Displaying an image that can't be closed nicochulo 4 3,771 Feb-15-2018, 10:27 AM
Last Post: nicochulo
  [PyQt] Whole application is closed by subwindows Alfalfa 1 7,492 Oct-03-2017, 03:22 PM
Last Post: Alfalfa
  doing something after been checked a checkbutton gray 1 4,370 Feb-18-2017, 05:11 PM
Last Post: Axel_Erfurt

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020