久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

    <bdo id='EIck1'></bdo><ul id='EIck1'></ul>

  • <legend id='EIck1'><style id='EIck1'><dir id='EIck1'><q id='EIck1'></q></dir></style></legend>

    <tfoot id='EIck1'></tfoot>
  • <small id='EIck1'></small><noframes id='EIck1'>

      <i id='EIck1'><tr id='EIck1'><dt id='EIck1'><q id='EIck1'><span id='EIck1'><b id='EIck1'><form id='EIck1'><ins id='EIck1'></ins><ul id='EIck1'></ul><sub id='EIck1'></sub></form><legend id='EIck1'></legend><bdo id='EIck1'><pre id='EIck1'><center id='EIck1'></center></pre></bdo></b><th id='EIck1'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='EIck1'><tfoot id='EIck1'></tfoot><dl id='EIck1'><fieldset id='EIck1'></fieldset></dl></div>

      1. AttributeError:模塊“PyQt5.QtGui"沒有屬性“QWidg

        AttributeError: module #39;PyQt5.QtGui#39; has no attribute #39;QWidget#39;(AttributeError:模塊“PyQt5.QtGui沒有屬性“QWidget)
        <tfoot id='t1fo1'></tfoot>

        <small id='t1fo1'></small><noframes id='t1fo1'>

          • <bdo id='t1fo1'></bdo><ul id='t1fo1'></ul>

            1. <legend id='t1fo1'><style id='t1fo1'><dir id='t1fo1'><q id='t1fo1'></q></dir></style></legend>

                <tbody id='t1fo1'></tbody>

                • <i id='t1fo1'><tr id='t1fo1'><dt id='t1fo1'><q id='t1fo1'><span id='t1fo1'><b id='t1fo1'><form id='t1fo1'><ins id='t1fo1'></ins><ul id='t1fo1'></ul><sub id='t1fo1'></sub></form><legend id='t1fo1'></legend><bdo id='t1fo1'><pre id='t1fo1'><center id='t1fo1'></center></pre></bdo></b><th id='t1fo1'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='t1fo1'><tfoot id='t1fo1'></tfoot><dl id='t1fo1'><fieldset id='t1fo1'></fieldset></dl></div>
                  本文介紹了AttributeError:模塊“PyQt5.QtGui"沒有屬性“QWidget"的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

                  所以,我正在嘗試為我擁有的 python 代碼制作 UI,但不斷遇到問題......

                  So, I'm trying to make a UI for a python code I have, but keep stumbling up on problems...

                  現在,代碼所做的只是創建一個帶有 2 個文本編輯器框和一個按鈕的窗口.按下按鈕時,它會打印測試".

                  Right now, all the code does is make a window, with 2 texteditor boxes, and one button. When the button is pressed, it prints 'Test'.

                  我使用 QTDesigner 制作 UI,然后使用 PyQt5 將其轉換為 python,并編輯了代碼.

                  I used QTDesigner to make the UI, then PyQt5 to convert it to python, and edited the code.

                  我的代碼:

                     # -*- coding: utf-8 -*-
                  
                  # Form implementation generated from reading ui file 'widget.ui'
                  #
                  # Created by: PyQt5 UI code generator 5.9
                  #
                  # WARNING! All changes made in this file will be lost!
                  
                  from PyQt5 import QtCore, QtGui, QtWidgets
                  
                  class Ui_Widget(QtGui.QWidget):
                      def setupUi(self, Widget):
                          Widget.setObjectName("Widget")
                          Widget.resize(681, 382)
                          self.horizontalLayout = QtWidgets.QHBoxLayout(Widget)
                          self.horizontalLayout.setContentsMargins(11, 11, 11, 11)
                          self.horizontalLayout.setSpacing(6)
                          self.horizontalLayout.setObjectName("horizontalLayout")
                          self.in_box = QtWidgets.QTextEdit(Widget)
                          self.in_box.setMaximumSize(QtCore.QSize(200, 350))
                          self.in_box.setObjectName("in_box")
                          self.horizontalLayout.addWidget(self.in_box)
                          self.convert = QtWidgets.QPushButton(Widget)
                          self.convert.setObjectName("convert")
                          self.horizontalLayout.addWidget(self.convert)
                          self.gridLayout = QtWidgets.QGridLayout()
                          self.gridLayout.setContentsMargins(11, 11, 11, 11)
                          self.gridLayout.setSpacing(6)
                          self.gridLayout.setObjectName("gridLayout")
                          self.out_box = QtWidgets.QTextEdit(Widget)
                          self.out_box.setMaximumSize(QtCore.QSize(200, 350))
                          self.out_box.setObjectName("out_box")
                          self.gridLayout.addWidget(self.out_box, 6, 0, 1, 1)
                          self.horizontalLayout.addLayout(self.gridLayout)
                  
                          self.retranslateUi(Widget)
                          QtCore.QMetaObject.connectSlotsByName(Widget)
                  
                      def retranslateUi(self, Widget):
                          _translate = QtCore.QCoreApplication.translate
                          Widget.setWindowTitle(_translate("Widget", "Converter"))
                          self.convert.setText(_translate("Widget", "Convert"))
                      self.convert.clicked.connect(self.convertclick)
                  
                      def convertclick(self):
                          print ('Test')
                  
                  
                  
                  if __name__ == "__main__":
                      import sys
                      app = QtWidgets.QApplication(sys.argv)
                      Widget = QtWidgets.QWidget()
                      ui = Ui_Widget()
                      ui.setupUi(Widget)
                      Widget.show()
                      sys.exit(app.exec_())
                  

                  這是我得到的錯誤:

                  AttributeError: module 'PyQt5.QtGui' has no attribute 'QWidget'
                  

                  即使我更改了 class Ui_Widget(QtGui.QWidget):class Ui_Widget(QtGui.QtWidgets):我得到 AttributeError: module 'PyQt5.QtGui' has no attribute 'QtWidgets'

                  Even when I change class Ui_Widget(QtGui.QWidget): to class Ui_Widget(QtGui.QtWidgets): I get AttributeError: module 'PyQt5.QtGui' has no attribute 'QtWidgets'

                  有誰知道問題出在哪里?

                  Anyone who knows what the problem may be?

                  干杯.

                  推薦答案

                  你的錯誤來自這里:

                  Ui_Widget(QtGui.QWidget)
                  

                  它基本上告訴你問題是什么.

                  It basically tells you what the problem is.

                  您似乎在這里混合了一些 QT4 和 QT5,因為您的導入是 QT5 風格,但 QtGui.QWidget 看起來像 QT4 風格.

                  It seems you are mixing some QT4 and QT5 here as your import is in QT5-style, but QtGui.QWidget looks like QT4-style.

                  將行替換為:

                  Ui_Widget(QtWidgets.QWidget)
                  

                  應該根據docs

                  備注:我不知道你到底在做什么,但是當你提到這個時:即使我將 class Ui_Widget(QtGui.QWidget): 更改為 class Ui_Widget(QtGui.QtWidgets): 我得到 AttributeError:模塊 'PyQt5.QtGui' 沒有屬性 'QtWidgets' 沒錯.您已經導入了 QtWidgets,而不是從 PyQt5.QtGui.只需在那里使用 Ui_Widget(QtWidgets).

                  Remark: I don't know what you are really doing, but when you mention this: Even when I change class Ui_Widget(QtGui.QWidget): to class Ui_Widget(QtGui.QtWidgets): I get AttributeError: module 'PyQt5.QtGui' has no attribute 'QtWidgets' That's correct. You already imported QtWidgets, and not from PyQt5.QtGui. Just use Ui_Widget(QtWidgets) there.

                  簡而言之:所有這些錯誤似乎都與 QT4 和 QT5 之間的模塊重構有關.文檔應該會有所幫助.

                  In short: all these errors seem to be related to refactoring in regards to the modules between QT4 and QT5. The docs should help.

                  這篇關于AttributeError:模塊“PyQt5.QtGui"沒有屬性“QWidget"的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

                  【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

                  相關文檔推薦

                  How to bind a function to an Action from Qt menubar?(如何將函數綁定到 Qt 菜單欄中的操作?)
                  PyQt progress jumps to 100% after it starts(PyQt 啟動后進度躍升至 100%)
                  How to set yaxis tick label in a fixed position so that when i scroll left or right the yaxis tick label should be visible?(如何將 yaxis 刻度標簽設置在固定位置,以便當我向左或向右滾動時,yaxis 刻度標簽應該可見
                  `QImage` constructor has unknown keyword `data`(`QImage` 構造函數有未知關鍵字 `data`)
                  Change x-axis ticks to custom strings(將 x 軸刻度更改為自定義字符串)
                  How to show progress bar while saving file to excel in python?(如何在python中將文件保存為excel時顯示進度條?)

                  <tfoot id='CUVm1'></tfoot>

                      <tbody id='CUVm1'></tbody>

                        <i id='CUVm1'><tr id='CUVm1'><dt id='CUVm1'><q id='CUVm1'><span id='CUVm1'><b id='CUVm1'><form id='CUVm1'><ins id='CUVm1'></ins><ul id='CUVm1'></ul><sub id='CUVm1'></sub></form><legend id='CUVm1'></legend><bdo id='CUVm1'><pre id='CUVm1'><center id='CUVm1'></center></pre></bdo></b><th id='CUVm1'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='CUVm1'><tfoot id='CUVm1'></tfoot><dl id='CUVm1'><fieldset id='CUVm1'></fieldset></dl></div>
                        <legend id='CUVm1'><style id='CUVm1'><dir id='CUVm1'><q id='CUVm1'></q></dir></style></legend>
                      1. <small id='CUVm1'></small><noframes id='CUVm1'>

                          <bdo id='CUVm1'></bdo><ul id='CUVm1'></ul>
                            主站蜘蛛池模板: 91精品国产综合久久久动漫日韩 | 伊人手机在线视频 | 欧美日韩国产不卡 | 国产日韩一区二区三免费 | 国产精品毛片一区二区在线看 | 精区3d动漫一品二品精区 | 亚洲综合视频 | 日日夜夜免费精品 | 美女黄网 | 亚洲成人免费在线观看 | 成人精品久久日伦片大全免费 | 99综合在线| 中文字幕视频在线观看 | 亚洲狠狠丁香婷婷综合久久久 | 国产精品美女久久久久久免费 | 欧美黄色一级毛片 | 国产在线播| 久草高清视频 | 国产一级毛片精品完整视频版 | 国产精品成人一区二区三区夜夜夜 | 亚洲精品欧美 | 国产视频久久 | 久久精品成人 | 91国内产香蕉| 青青久在线视频 | 欧美一区二区在线观看 | 在线成人www免费观看视频 | 国产美女黄色片 | 欧美精品久久久久久 | av第一页 | 日本一道本视频 | 97精品一区二区 | 午夜影院在线观看免费 | 在线亚洲一区二区 | 久久一级大片 | 亚洲国产成人av | 久久精品1 | 精品国产久| 久久精品网 | 久久精品国内 | 久久精品日产第一区二区三区 |