我在Qt Designer
中创建了两个文件,每个文件都会生成一个窗口。当我在window_one
中按一个按钮时,window_two
会打开。在第三个文件中,我导入了两个类,然后我构建了应用程序的逻辑部分。但现在我想获取有关window_one
中的小部件的信息并在window_two
中使用它,但我不知道该怎么做
from Window_ONE import window_one_ui
from Window_TWO import window_two_ui
class window_two(QtGui.QWidget, window_two_ui):
def __init__(self, parent=None):
super(window_two, self).__init__(parent)
self.setupUi(self)
def AnyFunction(self)
if self.QCheckBox.isChecked()==True #Here is the problem.
do somthing #QCheckBox was defined in the window_one_ui
class window_one(QtGui.QWidget, window_one_ui):
def __init__(self, parent=None):
super(window_one, self).__init__(parent)
self.setAttribute(QtCore.Qt.WA_DeleteOnClose)
self.setupUi(self)
def Open_window_two(self):
self.plotWindow = window_two()
self.plotWindow.show()
if __name__ == "__main__":
import sys
app = QtGui.QApplication(sys.argv)
Form = window_one()
Form.show()
sys.exit(app.exec_())
如何从windows_one
调用变量?