Python PyQt5.QtWidgets.QScrollBar() Examples
The following are 4
code examples of PyQt5.QtWidgets.QScrollBar().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
PyQt5.QtWidgets
, or try the search function
.
Example #1
Source File: filter.py From picasso with MIT License | 6 votes |
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
Example #2
Source File: terminal_dialog.py From uPyLoader with MIT License | 5 votes |
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()
Example #3
Source File: terminal_dialog.py From uPyLoader with MIT License | 5 votes |
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)
Example #4
Source File: flash_dialog.py From uPyLoader with MIT License | 5 votes |
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)