First handwritten essay.
Part of the Code for the project:
Change the label of the main form in the child thread.
Class MyForm (Qdialog):
def __init__ (self, Parent=none):
Self.configbox = Myconfigform ()
#configBox为另一个类的实例, connecting to another class, singnal () understands that it defines a name for the signal. Self.set_begin_with is a way to modify the label in this method.
Self.connect (Self.configbox, SIGNAL ("Set_begin_with"), Self.set_begin_with)
In any of the methods in the Myconfigform class.
def set_begin_with_snormac (self):
Testconfig = testconf ()
if (self.ui.radioButton_7.isChecked ()):
TESTCONFIG.SET_BEGIN_SN ()
# Self.frm_ui.label.setText (U "SN:")
Self.emit (SIGNAL ("Set_begin_with")) #发送名称为set_begin_with signal,
Else
Testconfig.set_beging_mac ()
# Self.frm_ui.label.setText (U "MAC")
Self.emit (SIGNAL ("Set_begin_with"))
Signals and slots are understood as two steps:
1 Connect an instance of another class in the main class. and defines the name of a signal. And the method that is executed after the signal is triggered.
2 in another class, just send this signal. The main class can accept the signal and trigger the signal and execute the method.
In the study, there is something wrong in the place to welcome correct. Thank you
PYQT signal and Slot application examples