关于在pycharm中使用Python PyQt5
我试着在pycharm中运行PyQt5,它一开始起作用,因为我可以看到一个窗口弹出,上面有一个固定的标题关于在pycharm中使用Python PyQt5,python,pyqt5,Python,Pyqt5,我试着在pycharm中运行PyQt5,它一开始起作用,因为我可以看到一个窗口弹出,上面有一个固定的标题 import sys from PyQt5 import QtCore from PyQt5.QtGui import QCursor from PyQt5.QtGui import QPixmap from PyQt5.QtWidgets import QApplication, QLabel, QPushButton, QWidget, QGridLayout app = QAppl
import sys
from PyQt5 import QtCore
from PyQt5.QtGui import QCursor
from PyQt5.QtGui import QPixmap
from PyQt5.QtWidgets import QApplication, QLabel, QPushButton, QWidget, QGridLayout
app = QApplication(sys.argv)
window = QWidget()
window.setWindowTitle("Who wants to be a programmer?")
window.setFixedWidth(1000)
window.show()
sys.exit(app.exec())
如果我运行此代码,则会出现一个带有标题的窗口!
但是如果我尝试更多地处理它并运行代码,任务栏上会出现一个窗口,但我无法看到或打开它 尝试子类化QWidget或QMainWindow。将提供更好的可控性
import sys
from PyQt5 import QtCore
from PyQt5.QtGui import QCursor
from PyQt5.QtGui import QPixmap
from PyQt5.QtWidgets import QApplication, QLabel, QPushButton, QWidget, QGridLayout
app = QApplication(sys.argv)
window = QWidget()
window.setWindowTitle("Who wants to be a programmer?")
window.setFixedWidth(1000)
b11=QPushButton(window)
class w2(QWidget):
def __init__(self):
super(QWidget,self).__init__()
self.b1=QPushButton(self)
w_2=w2()
w_2.show()
sys.exit(app.exec())
你说的“但是如果我试着做更多的工作并运行代码”是什么意思?