Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. PyQt5 Assign multiple functions to a button
Forum Updated to NodeBB v4.3 + New Features

PyQt5 Assign multiple functions to a button

Scheduled Pinned Locked Moved Unsolved General and Desktop
2 Posts 2 Posters 1.7k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • K Offline
    K Offline
    kolle
    wrote on 3 Apr 2021, 17:16 last edited by
    #1

    Hey, i want to assign multiple functions to a button but the second function doesnt execute when i click the button. It works when i only connect the second function to the button. That's the code snipped:

    ui.button_start.clicked.connect(lambda: bot.accept_request(loop=True))
    ui.button_start.clicked.connect(lambda: ui.button_start.setText("Stop"))
    

    i already searched on the internet and they say that it should work, but it doesn't :(

    I'm happy about every answer! :)

    P 1 Reply Last reply 3 Apr 2021, 17:58
    0
    • K kolle
      3 Apr 2021, 17:16

      Hey, i want to assign multiple functions to a button but the second function doesnt execute when i click the button. It works when i only connect the second function to the button. That's the code snipped:

      ui.button_start.clicked.connect(lambda: bot.accept_request(loop=True))
      ui.button_start.clicked.connect(lambda: ui.button_start.setText("Stop"))
      

      i already searched on the internet and they say that it should work, but it doesn't :(

      I'm happy about every answer! :)

      P Offline
      P Offline
      Pl45m4
      wrote on 3 Apr 2021, 17:58 last edited by
      #2

      @kolle said in PyQt5 Assign multiple functions to a button:

      lambda: bot.accept_request(loop=True)

      What does this do? If it is a loop that blocks your EventLoop, the second signal can't get through.


      If debugging is the process of removing software bugs, then programming must be the process of putting them in.

      ~E. W. Dijkstra

      1 Reply Last reply
      1

      1/2

      3 Apr 2021, 17:16

      • Login

      • Login or register to search.
      1 out of 2
      • First post
        1/2
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved