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

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

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

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

        <tfoot id='NDdBV'></tfoot>

        為什么標簽沒有完全顯示?

        Why does the label not fully display?(為什么標簽沒有完全顯示?)
          <bdo id='JB7i6'></bdo><ul id='JB7i6'></ul>
          1. <i id='JB7i6'><tr id='JB7i6'><dt id='JB7i6'><q id='JB7i6'><span id='JB7i6'><b id='JB7i6'><form id='JB7i6'><ins id='JB7i6'></ins><ul id='JB7i6'></ul><sub id='JB7i6'></sub></form><legend id='JB7i6'></legend><bdo id='JB7i6'><pre id='JB7i6'><center id='JB7i6'></center></pre></bdo></b><th id='JB7i6'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='JB7i6'><tfoot id='JB7i6'></tfoot><dl id='JB7i6'><fieldset id='JB7i6'></fieldset></dl></div>

                  <tbody id='JB7i6'></tbody>
                <legend id='JB7i6'><style id='JB7i6'><dir id='JB7i6'><q id='JB7i6'></q></dir></style></legend>

              • <small id='JB7i6'></small><noframes id='JB7i6'>

                • <tfoot id='JB7i6'></tfoot>
                  本文介紹了為什么標簽沒有完全顯示?的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

                  我正在學習如何使用 PyQt5,但遇到了我的第一個標簽"未在我的屏幕上完全顯示的問題.

                  I am learning how to use PyQt5 and I came across this issue where "my first label" does not complete display on my screen.

                  運行代碼后顯示:

                  代碼:

                  from PyQt5 import QtWidgets, QtCore, QtGui
                  from PyQt5.QtCore import *
                  from PyQt5.QtGui  import *
                  from PyQt5.QtWidgets import QApplication, QMainWindow
                  import sys
                  
                  QtWidgets.QApplication.setAttribute(QtCore.Qt.AA_EnableHighDpiScaling, True) #enable highdpi scaling
                  QtWidgets.QApplication.setAttribute(QtCore.Qt.AA_UseHighDpiPixmaps, True) #use highdpi icons
                  
                  def window():
                    app = QApplication(sys.argv)
                    win = QMainWindow()
                    win = QMainWindow()
                    win.setGeometry(200, 200, 400, 400)
                    win.setWindowTitle("Tech with Aeijan")
                    label = QtWidgets.QLabel(win)
                    label.setText("my first label!")
                    label.move(50,50)
                  
                    win.show()
                    sys.exit(app.exec_())
                  
                  window()
                  

                  推薦答案

                  QLabel 根據(可能的)父布局管理器來適配它的內容,但是你沒有使用任何,所以它不知道如何正確顯示自己或調整它的大小來做到這一點.

                  QLabel adapts its contents based on the (possible) parent layout manager, but you didn't use any, so it doesn't know how to correctly display itself or adapt its size to do that.

                  最簡單的解決方案是調用label.adjustSize(),這將導致標簽自身調整大小,以便能夠顯示其內容.

                  The simplest solution is to call label.adjustSize(), which will cause the label to resize itself so that it will be able to display its contents.

                  不過,這不是一個好主意:您正在嘗試為小部件使用固定位置(由于很多原因,這通常被認為是一件壞事);結果將是,如果標簽文本太大并且用戶調整窗口大小,文本將不會完全可見,標簽也不知道如何調整大小或最終包裝其內容以確保所有顯示其文本.

                  That wouldn't be a very good idea, though: you are trying to use a fixed position for a widget (which is normally considered a bad thing to do, for plenty of reasons); the result will be that if the label text is too big and the user resizes the window, the text won't be completely visible as it should be, nor the label would know how to resize or eventually wrap its contents to do ensure that all its text is shown.

                  更好的方法是使用布局管理器,但這是為更簡單的小部件(如 QWidget 或 QDialog)保留的解決方案;QMainWindow 不能那樣工作,并且它需要設置一個中央小部件以確保其內容正確顯示和管理.

                  The better approach is to use a layout manager, but that is a solution reserved for simpler widgets (like a QWidget or a QDialog); a QMainWindow doesn't work like that, and it requires a central widget to be set to ensure that its contents are correctly displayed and managed.

                  在您的情況下,您可以簡單地使用 self.setCentralWidget(label),但這會阻止您將任何其他小部件添加到您的窗口.

                  In your case, you could simply use self.setCentralWidget(label), but that would prevent you to add any other widget to your window.

                  應該使用容器"小部件,并且該小部件將設置為主窗口的中心;然后您可以為該小部件設置布局并為其添加標簽:

                  A "container" widget should be used instead, and that widget would be set as the central one for the main window; then you can set a layout for that widget and add the label to it:

                  def window():
                      app = QApplication(sys.argv)
                      win = QMainWindow()
                  
                      central = QWidget()
                      win.setCentralWidget(central)
                  
                      layout = QVBoxLayout()
                      central.setLayout(layout)
                      # alternatively, the above is the same as this:
                      # layout = QVBoxLayout(central)
                  
                      label = QtWidgets.QLabel(win)
                      label.setText("my first label!")
                      layout.addWidget(label)
                  
                      # ...
                  

                  這篇關于為什么標簽沒有完全顯示?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持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時顯示進度條?)

                  <legend id='ACtJy'><style id='ACtJy'><dir id='ACtJy'><q id='ACtJy'></q></dir></style></legend>

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

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

                      <tbody id='ACtJy'></tbody>

                          <i id='ACtJy'><tr id='ACtJy'><dt id='ACtJy'><q id='ACtJy'><span id='ACtJy'><b id='ACtJy'><form id='ACtJy'><ins id='ACtJy'></ins><ul id='ACtJy'></ul><sub id='ACtJy'></sub></form><legend id='ACtJy'></legend><bdo id='ACtJy'><pre id='ACtJy'><center id='ACtJy'></center></pre></bdo></b><th id='ACtJy'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='ACtJy'><tfoot id='ACtJy'></tfoot><dl id='ACtJy'><fieldset id='ACtJy'></fieldset></dl></div>
                          <tfoot id='ACtJy'></tfoot>
                          1. 主站蜘蛛池模板: 精品无码久久久久久久动漫 | 在线观看不卡av | 一级黄色片毛片 | 亚洲福利在线观看 | 日日操操 | 中文字幕爱爱视频 | 欧美电影免费观看高清 | 九色av| 欧洲av一区| 国产成人综合在线 | 日日草夜夜草 | 羞羞视频免费观 | 性高湖久久久久久久久 | 日韩一区二区三区在线视频 | 亚洲精品一区二区三区在线观看 | 免费观看视频www | 在线免费看黄 | 欧美成人免费在线 | 97国产在线视频 | 亚洲福利一区 | 亚洲精品一区二区冲田杏梨 | 九色在线 | 丁香五月网久久综合 | 国产欧美日韩一区二区三区在线 | 一区天堂 | 午夜天堂 | 国产综合视频 | 婷婷丁香在线视频 | 夜夜骑天天干 | 亚洲欧美日韩一区二区 | 九色在线 | 韩日精品一区 | 欧美午夜在线 | 国产一区二区在线观看视频 | 欧美视频一区二区三区 | 精品9999 | 国产精品视频久久 | 久久综合九九 | 蜜桃视频成人 | 国产高清视频 | 91精品国产自产在线老师啪 |