pyside connection Error “RuntimeError: Failed to connect signal clicked()”

前端 未结 2 1483
不知归路
不知归路 2020-12-10 20:28
from PySide.QtCore import *
from PySide.QtGui import *

import sys
import stackwid

class Dialog(QDialog,stackwid.Ui_Dialog):

    def __init__(self,parent = None):
         


        
相关标签:
2条回答
  • 2020-12-10 20:49

    You don't connect the signal to your set()-function, but to it's return value. You just need to remove the parenthesis, then it should work:

    self.camButton.clicked.connect(self.set)
    
    0 讨论(0)
  • 2020-12-10 20:58

    Passing extra arguments to slots, this may help you ,good luck!

    self.camButton.clicked.connect(lambda: self.set(index))
    
    def set(self, index):
    
        self.stackedWidget.setCurrentIndex(index)
    
    0 讨论(0)
提交回复
热议问题