我正在使用如下代码创建GUI:
class MyClass2(QtGui.QMainWindow):
def __init__(self, win_parent = None):
def on_blahblah_clicked(x):
if __name__ == "__main__":
# Someone is launching this directly
# Create the QApplication
app = QtGui.QApplication(sys.argv)
#The Main window
main_window = HyperlinkWindow()
main_window.show()
# Enter the main loop
app.exec_()
我有一个像这样的加载项按钮的代码:
class MyClass(object):
"""Impementation of Some_addin.button (Button)"""
def __init__(self):
#Code here
def onClick(self):
# Code
pass
我想创建一个加载项按钮,单击它时会显示上面创建的GUI。所以我希望能够在函数onClick中调用GUI代码的类MyClass2。就像我在下面的代码中使用y一样:
class x:
a = 1 + 1
class y:
print x.a