<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中创建可以用鼠标修改的图形滑块?

        时间:2024-08-10

        <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中创建可以用鼠标修改的图形滑块?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:pysppark&39;s&quot;BETWEEN&QUOT;函数:时间戳上的范围搜索不包括在 下一篇:根据其中一段视频重建Veritasium的情节

                  相关文章

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

                  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>