当前位置: 首页>>代码示例>>Python>>正文


Python QtWidgets.QScrollBar方法代码示例

本文整理汇总了Python中PyQt5.QtWidgets.QScrollBar方法的典型用法代码示例。如果您正苦于以下问题:Python QtWidgets.QScrollBar方法的具体用法?Python QtWidgets.QScrollBar怎么用?Python QtWidgets.QScrollBar使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PyQt5.QtWidgets的用法示例。


在下文中一共展示了QtWidgets.QScrollBar方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: _scroll_released

# 需要导入模块: from PyQt5 import QtWidgets [as 别名]
# 或者: from PyQt5.QtWidgets import QScrollBar [as 别名]
def _scroll_released(self):
        if not self.autoscrollCheckBox.isChecked():
            self._auto_scroll = False
            return

        scrollbar = self.outputTextEdit.verticalScrollBar()
        assert isinstance(scrollbar, QScrollBar)
        current_scroll = scrollbar.value()
        self._auto_scroll = current_scroll >= scrollbar.maximum() 
开发者ID:BetaRavener,项目名称:uPyLoader,代码行数:11,代码来源:terminal_dialog.py

示例2: update_content

# 需要导入模块: from PyQt5 import QtWidgets [as 别名]
# 或者: from PyQt5.QtWidgets import QScrollBar [as 别名]
def update_content(self):
        new_content = self.terminal.read()
        new_content = self.process_backspaces(new_content)
        if not new_content:
            return

        scrollbar = self.outputTextEdit.verticalScrollBar()
        assert isinstance(scrollbar, QScrollBar)
        # Preserve scroll while updating content
        current_scroll = scrollbar.value()

        prev_cursor = self.outputTextEdit.textCursor()
        self.outputTextEdit.moveCursor(QTextCursor.End)
        # Use any backspaces that were left in input to delete text
        cut = 0
        for x in new_content:
            if x != "\b":
                break
            self.outputTextEdit.textCursor().deletePreviousChar()
            cut += 1
        self.outputTextEdit.insertPlainText(new_content[cut:])
        self.outputTextEdit.setTextCursor(prev_cursor)

        if self._auto_scroll:
            scrollbar.setValue(scrollbar.maximum())
        else:
            scrollbar.setValue(current_scroll) 
开发者ID:BetaRavener,项目名称:uPyLoader,代码行数:29,代码来源:terminal_dialog.py

示例3: _update_output

# 需要导入模块: from PyQt5 import QtWidgets [as 别名]
# 或者: from PyQt5.QtWidgets import QScrollBar [as 别名]
def _update_output(self):
        scrollbar = self.outputEdit.verticalScrollBar()
        assert isinstance(scrollbar, QScrollBar)
        # Preserve scroll while updating content
        current_scroll = scrollbar.value()
        scrolling = scrollbar.isSliderDown()

        with self._flash_output_mutex:
            self.outputEdit.setPlainText(self._flash_output.decode('utf-8', errors="ignore"))

        if not scrolling:
            scrollbar.setValue(scrollbar.maximum())
        else:
            scrollbar.setValue(current_scroll) 
开发者ID:BetaRavener,项目名称:uPyLoader,代码行数:16,代码来源:flash_dialog.py

示例4: __init__

# 需要导入模块: from PyQt5 import QtWidgets [as 别名]
# 或者: from PyQt5.QtWidgets import QScrollBar [as 别名]
def __init__(self):
        super().__init__()
        # Init GUI
        self.setWindowTitle("Picasso: Filter")
        self.resize(1100, 750)
        this_directory = os.path.dirname(os.path.realpath(__file__))
        icon_path = os.path.join(this_directory, "icons", "filter.ico")
        icon = QtGui.QIcon(icon_path)
        self.setWindowIcon(icon)
        menu_bar = self.menuBar()
        file_menu = menu_bar.addMenu("File")
        open_action = file_menu.addAction("Open")
        open_action.setShortcut(QtGui.QKeySequence.Open)
        open_action.triggered.connect(self.open_file_dialog)
        file_menu.addAction(open_action)
        save_action = file_menu.addAction("Save")
        save_action.setShortcut(QtGui.QKeySequence.Save)
        save_action.triggered.connect(self.save_file_dialog)
        file_menu.addAction(save_action)
        plot_menu = menu_bar.addMenu("Plot")
        histogram_action = plot_menu.addAction("Histogram")
        histogram_action.setShortcut("Ctrl+H")
        histogram_action.triggered.connect(self.plot_histogram)
        scatter_action = plot_menu.addAction("2D Histogram")
        scatter_action.setShortcut("Ctrl+D")
        scatter_action.triggered.connect(self.plot_hist2d)
        self.table_view = TableView(self, self)
        main_widget = QtWidgets.QWidget()
        hbox = QtWidgets.QHBoxLayout(main_widget)
        hbox.setContentsMargins(0,0,0,0)
        hbox.setSpacing(0)
        self.setCentralWidget(main_widget)
        hbox.addWidget(self.table_view)
        self.vertical_scrollbar = QtWidgets.QScrollBar()
        self.vertical_scrollbar.valueChanged.connect(self.display_locs)
        hbox.addWidget(self.vertical_scrollbar)
        self.hist_windows = {}
        self.hist2d_windows = {}
        self.filter_log = {}
        self.locs = None 
开发者ID:jungmannlab,项目名称:picasso,代码行数:42,代码来源:filter.py


注:本文中的PyQt5.QtWidgets.QScrollBar方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。