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

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

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

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

        <tfoot id='qryeb'></tfoot>

        我想把文本放在 pyqt QCalendarWidget

        I want to put the text in pyqt QCalendarWidget(我想把文本放在 pyqt QCalendarWidget)

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

        1. <tfoot id='dM8Fa'></tfoot>

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

                1. 本文介紹了我想把文本放在 pyqt QCalendarWidget的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

                  我想把 p.drawText (rx() + 10, ry() + 33, '{}/{}'.format('tset1', 'test2')的文字放code> 選擇的 QCalendarWidget 日期的條件.但是不好.

                  I would like to put the text of p.drawText (r.x () + 10, r.y () + 33, '{} / {}'. Format ('tset1', 'test2') condition on the selected QCalendarWidget date. But it is not good.

                  import sys
                  from PyQt5.QtGui import *
                  from PyQt5.QtCore import *
                  from PyQt5.QtWidgets import *
                  
                  class main_window(QWidget):
                      def __init__(self):
                          super(main_window, self).__init__()
                          self.resize(1280, 900)
                  
                          self.Calendar() 
                  
                      def Calendar(self):
                          self.cal = QCalendarWidget(self)    
                          self.cal.resize(500, 500)
                          self.cal.clicked.connect(self.Calendar_click)
                  
                      def Calendar_click(self):
                          p = QPainter()
                          r = QRect(0,0,10,10)
                          d = self.cal.selectedDate()
                          self.cal.paintCell(p, r, d)
                          if (d == QDate.currentDate()):      
                              f = QFont()
                              f.setPixelSize(10)
                              f.setBold(True)
                              f.setItalic(True)
                              p.setFont(f)
                              p.drawText(r.x()+10, r.y()+33, '{}/{}'.format('tset1','test2'))
                  
                  if __name__ == '__main__':
                      app = QApplication(sys.argv)
                      main = main_window()
                      main.show()
                  

                  我嘗試了很多,但我仍然不知道如何在選定的日期上放置小文本.

                  I've tried many, but I still do not know how to put small text on the selected date.

                  推薦答案

                  你必須重寫 paintCell() 方法,因為這個方法是在paintEvent()中調用的:

                  You have to overwrite the paintCell() method since this method is called in paintEvent():

                  class CalendarWidget(QCalendarWidget):
                      def paintCell(self, painter, rect, date):
                          super(CalendarWidget, self).paintCell(painter, rect, date)
                          if date == self.selectedDate():
                              painter.save()
                              f = QFont()
                              f.setPixelSize(10)
                              f.setBold(True)
                              f.setItalic(True)
                              painter.setFont(f)
                              r = rect
                              painter.drawText(
                                  rect.topLeft() + QPoint(10, 33),
                                  "{}/{}".format("tset1", "test2"),
                              )
                              painter.restore()
                  
                  
                  class main_window(QWidget):
                      def __init__(self):
                          super(main_window, self).__init__()
                          self.resize(1280, 900)
                          self.Calendar()
                  
                      def Calendar(self):
                          self.cal = CalendarWidget(self)
                          self.cal.resize(500, 500)
                  

                  <小時>

                  更新:

                  如果您希望保留文本,則必須保存日期并在必要時重新繪制,因為 Qt 會重新繪制所有內容

                  If you want the text to remain, you must save the date and repaint if necessary since Qt repaints everything

                  class CalendarWidget(QCalendarWidget):
                      def __init__(self, parent=None):
                          super(CalendarWidget, self).__init__(parent)
                          self._selected_dates = set()
                          self._selected_dates.add(self.selectedDate())
                          self.clicked.connect(self.on_clicked)
                  
                      @pyqtSlot(QDate)
                      def on_clicked(self, date):
                          self._selected_dates.add(date)
                  
                      def paintCell(self, painter, rect, date):
                          super(CalendarWidget, self).paintCell(painter, rect, date)
                          if date in self._selected_dates:
                              painter.save()
                              f = QFont()
                              f.setPixelSize(10)
                              f.setBold(True)
                              f.setItalic(True)
                              painter.setFont(f)
                              r = rect
                              painter.drawText(
                                  rect.topLeft() + QPoint(10, 33),
                                  "{}/{}".format("tset1", "test2"),
                              )
                              painter.restore()
                  

                  這篇關于我想把文本放在 pyqt QCalendarWidget的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持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時顯示進度條?)

                    1. <legend id='bkAoJ'><style id='bkAoJ'><dir id='bkAoJ'><q id='bkAoJ'></q></dir></style></legend>
                        <tbody id='bkAoJ'></tbody>
                        <bdo id='bkAoJ'></bdo><ul id='bkAoJ'></ul>

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

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

                            主站蜘蛛池模板: 青青在线| 国产在线播放av | 国产一级特黄aaa大片 | 国产一级一片免费播放放a 免费国产视频 | 久久伊人精品 | 中文在线观看免费视频 | 欧美性猛交xxxx| 国产人成一区二区三区影院 | 日本三级韩国三级美三级91 | 在线观看日韩视频 | 日日操天天操 | 日韩在线中文字幕 | 在线免费播放av | 久久都是精品 | 国产91在线播放 | 欧美午夜精品久久久久免费视 | 欧美精品成人一区二区在线观看 | 色综合久久综合 | 日韩中文字幕第一页 | 久久久精品在线 | 国产理论片在线观看 | 午夜视频在线 | 欧美成年人视频 | 久久久青草| 亚洲成人免费观看 | www.日韩| 在线中文字幕网站 | 国产成人午夜高潮毛片 | 亚洲国产成人精品女人久久久 | 欧美日韩一区在线 | 天天色天天 | 免费黄色片视频 | 欧美三级大片 | 国产又粗又猛又黄又爽无遮挡 | 99九九久久| 成av人片一区二区三区久久 | 欧美一级网站 | 欧美日韩国产一区二区 | 天天干夜夜骑 | 黄色免费av | 日韩一级黄色片 |