pyqt4

How to change languages(translations) dynamically on PyQt5?

How to change languages(translations) dynamically on PyQt5? Question: I wonder if it is possible to change the languages(translations) dynamically without using qt designer to make the UI? That means I don’t want to use the function retranslateUi() to update the program interface. Here is my code, but I’m stuck on lines marked #1 #2 #3. …

Total answers: 3

pyqt4 how to know textEdit field is empty

pyqt4 how to know textEdit field is empty Question: I want to know if textbox is empty or not. So, I made this code. But, if self.row is ‘ ‘ <- this is not working. Although, textEdit field is empty but, it’s not recognize. def setUi(self): self.textEdit = QtGui.QTextEdit(MainWindow) self.textEdit.setGeometry(QtCore.QRect(155, 90, 471, 31)) self.textEdit.setObjectName(_fromUtf8(“textEdit”)) def …

Total answers: 1

Copy/Paste multiple items from QTableView in pyqt4?

Copy/Paste multiple items from QTableView in pyqt4? Question: We can select multiple items(partial rows and partial columns) from QTableView using self.tableView.setSelectionMode(QAbstractItemView.ExtendedSelection), but after selecting some rows and columns(partial and partial) if I do CTRL+C and paste it in notepad it only pastes one item(one value from the tableView)? My Code: tab_table_view = QtGui.QWidget() self.Tab.insertTab(0, tab_table_view, …

Total answers: 5

QComboBox adjust drop down width

QComboBox adjust drop down width Question: Not sure why I cant get it to work, so maybe one of you will be able to see my mistake… : combo_type = QComboBox() combo_type.setMaximumWidth(50) combo_type.addItems([“TEsst1111″,”TEsst11111111111111″,”TEsst1111111111111111111111111″]) combo_type.setStyleSheet(”’* QComboBox QAbstractItemView::item { min-width: 6000px; } ”’) The idea is so that widget in UI has 50 width but when drop …

Total answers: 3

Saving the current value of a variable for later use in a local scope

Saving the current value of a variable for later use in a local scope Question: I want to to create functions in a loop, depending on the loop variable (for use with PyQT), but the functions are not “dereferencing” the loop variable as I want. (I don’t know the proper terminology, so forgive my sloppiness.) …

Total answers: 2

How to enable Pan and Zoom in a QGraphicsView

How to enable Pan and Zoom in a QGraphicsView Question: I am using python and Qt Designer to implement loading tiff images and to enable Pan and Zoom on some mouse event (wheel – zoom, press wheel – pan). I was looking into some options and classes that can work with images etc, and so …

Total answers: 3

Show string values on x-axis in pyqtgraph

Show string values on x-axis in pyqtgraph Question: I want to display string values for ticks on x-axis in pyqtgraph. Right now I am unable to figure out how to do that. Ex: x = [‘a’, ‘b’, ‘c’, ‘d’, ‘e’, ‘f’] y = [1, 2, 3, 4, ,5, 6] pg.plot(x, y) When I try to …

Total answers: 4

How to have pushbutton click event to connect to closeEvent? PyQt4

How to have pushbutton click event to connect to closeEvent? PyQt4 Question: I would like to have two different methods for quitting the app: By pressing the default “X” button on the left top corner. Pressing custom QPushButton(“Quit”) The event where “X” is pressed is connected to a closeEvent function: def closeEvent(self, event): message = …

Total answers: 2

Unable to load files using pickle and multiple modules

Unable to load files using pickle and multiple modules Question: I’m trying to create a user system, which uses a setting and Gui module, and when the GUI module requests for the file to load up using pickle, I keep getting an attribute error. this is from the settings module: import pickle import hashlib class …

Total answers: 5

Creating a transparent overlay with qt

Creating a transparent overlay with qt Question: I’ve been learning python recently and now I wanted to (try to) create my first real application, a subtitle player for Linux. So far I’ve been using the Greenfish subtitle player, which is aimed at Windows users and not properly working in Linux. I wanted to create the …

Total answers: 2