<tfoot id='DMduS'></tfoot>

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

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

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

        如何在Python中创建可以用鼠标修改的图形滑块?

        How to create graphic slider in Python that can be modified with mouse?(如何在Python中创建可以用鼠标修改的图形滑块?)

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

        <legend id='uazA0'><style id='uazA0'><dir id='uazA0'><q id='uazA0'></q></dir></style></legend>
          <bdo id='uazA0'></bdo><ul id='uazA0'></ul>
              <tbody id='uazA0'></tbody>

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

              • <tfoot id='uazA0'></tfoot>

                1. 本文介绍了如何在Python中创建可以用鼠标修改的图形滑块?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  如何在PyQt中创建可用鼠标从0修改为100的类似于进度条的图形滑块?

                  QSlider

                  您必须适当设置推荐答案样式表。此解决方案基于PyQt5

                  import sys
                  from PyQt5 import QtGui, QtCore, QtWidgets
                  
                  class MyApp(object):    
                      def __init__(self):
                          super(MyApp, self).__init__()                
                          self.mainWidget = QtWidgets.QWidget()
                          self.mainLayout = QtWidgets.QVBoxLayout()
                          self.mainWidget.setLayout(self.mainLayout)
                  
                          self.slider = QtWidgets.QSlider()
                          self.slider.setOrientation(QtCore.Qt.Horizontal)
                          self.slider.setStyleSheet(self.stylesheet())
                  
                          self.mainLayout.addWidget(self.slider)
                          self.mainWidget.show()
                          sys.exit(app.exec_())
                  
                      def stylesheet(self):
                          return """
                              QSlider::groove:horizontal {
                                  background: white;
                                  height: 40px;
                              }
                  
                              QSlider::sub-page:horizontal {
                                  background: qlineargradient(x1: 0, y1: 0,    x2: 0, y2: 1,
                                      stop: 0 #66e, stop: 1 #bbf);
                                  background: qlineargradient(x1: 0, y1: 0.2, x2: 1, y2: 1,
                                      stop: 0 #bbf, stop: 1 #55f);
                                  height: 40px;
                              }
                  
                              QSlider::add-page:horizontal {
                                  background: #fff;
                                  height: 40px;
                              }
                  
                              QSlider::handle:horizontal {
                                  background: #bbf;
                                  border: 0px;
                                  width: 0px;
                                  margin-top: 0px;
                                  margin-bottom: 0px;
                                  border-radius: 0px;
                              }
                          """
                  
                  if __name__ == '__main__':
                      app = QtWidgets.QApplication(sys.argv)
                      MyApp()
                  

                  这是输出组件

                  这篇关于如何在Python中创建可以用鼠标修改的图形滑块?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  GUI Freezes while downloading PyQt5 and Pytube(GUI在下载PyQt5和Pytube时冻结)
                  How to solve memory issues while multiprocessing using Pool.map()?(如何解决使用Pool.map()进行多处理时的内存问题?)
                  Python - How to use FastAPI and uvicorn.run without blocking the thread?(Python-如何使用FastAPI和uvicorn.run而不阻塞线程?)
                  How to increment a shared counter from multiple processes?(如何从多个进程递增共享计数器?)
                  Using pika, how to connect to rabbitmq running in docker, started with docker-compose with external network?(使用pika,如何连接运行在docker中的rabbitmq,从docker开始-与外部网络连接?)
                  How to use .rolling() on each row of a Pandas dataframe?(如何对 pandas 数据帧的每一行使用.roll()?)

                  <legend id='9MNyO'><style id='9MNyO'><dir id='9MNyO'><q id='9MNyO'></q></dir></style></legend>
                    <bdo id='9MNyO'></bdo><ul id='9MNyO'></ul>

                        <tbody id='9MNyO'></tbody>
                    1. <small id='9MNyO'></small><noframes id='9MNyO'>

                    2. <tfoot id='9MNyO'></tfoot>

                          1. <i id='9MNyO'><tr id='9MNyO'><dt id='9MNyO'><q id='9MNyO'><span id='9MNyO'><b id='9MNyO'><form id='9MNyO'><ins id='9MNyO'></ins><ul id='9MNyO'></ul><sub id='9MNyO'></sub></form><legend id='9MNyO'></legend><bdo id='9MNyO'><pre id='9MNyO'><center id='9MNyO'></center></pre></bdo></b><th id='9MNyO'></th></span></q></dt></tr></i><div id='9MNyO'><tfoot id='9MNyO'></tfoot><dl id='9MNyO'><fieldset id='9MNyO'></fieldset></dl></div>