簡體   English   中英

QT代碼,運行程序時什么也沒發生

[英]QT code, nothing happens when I run the program

我目前正在學習qt,我有一個理解為什么我的代碼無法按我希望的那樣工作的問題。 它根本不輸出任何東西。 沒有窗口顯示,甚至沒有顯示測試打印語句

尷尬的是,代碼返回了退出代碼0,在PyCharm中沒有明顯的問題可以看到,我迷路了。 我咨詢了幾個朋友,但是沒有一個人能幫助我解決這個問題。

from PySide.QtGui import QWidget, QApplication, QCheckBox, QPushButton, QPixmap, QLabel, QRadioButton
import sys

class ersteklasse(QWidget):
    def __init__(self):
        super(ersteklasse, self).__init__()
        self.initGui()
        self.initButton()

        print "I am there"

    def initGui(self):
        self.setGeometry(0, 0, 800, 600)
        self.setWindowTitle('Henris kleines Programm')
        filepath = '/Users/henrinehlsen/Desktop/KaNe_Logo_TEST_PORTFOLIOBOX.png'
        pix1 = QPixmap(filepath)
        self.img1 = QLabel
        self.img1.setPixmap(pix1)

        print "me too!"

    def initButton(self):
        self.Button1 = QRadioButton("Nope", self)
        self.Button1.move(100, 100)

if __name__ == "main":
    app = QApplication
    ErstesProgramm = ersteklasse()
    ErstesProgramm.show()
    sys.exit(app.exec_())
if __name__ == "main":

應該讀

if __name__ == "__main__":

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM