pyside

Placeholder text not showing (pyside/pyqt)

走远了吗. 提交于 2019-12-01 18:00:57
Learning PySide, I'm tweaking a text edit widget (QLineEdit) and trying to set the placeholder text using setPlaceHolderText as in the code snippet below (which I invoke from main ). Unfortunately, it is not working as I expected. The code runs, but the text box is blank, does not show the placeholder text. I am in Windows 7, Python 2.7 (working in iPython). class MyTextEdit(QtGui.QWidget): def __init__(self): QtGui.QWidget.__init__(self) self.textEditor=QtGui.QLineEdit(self) self.textEditor.move(50,15) self.textEditor.setPlaceholderText("Don't mind me.") self.setGeometry(100, 100, 200, 50)

PySide wait for signal from main thread in a worker thread

眉间皱痕 提交于 2019-12-01 16:43:40
I decided to add a GUI to one of my scripts. The script is a simple web scraper. I decided to use a worker thread as downloading and parsing the data can take a while. I decided to use PySide, but my knowledge of Qt in general is quite limited. As the script is supposed to wait for user input upon coming across a captcha I decided it should wait until a QLineEdit fires returnPressed and then send it's content to the worker thread so it can send it for validation. That should be better than busy-waiting for the return key to be pressed. It seems that waiting for a signal isn't as straight

Placeholder text not showing (pyside/pyqt)

醉酒当歌 提交于 2019-12-01 16:10:33
问题 Learning PySide, I'm tweaking a text edit widget (QLineEdit) and trying to set the placeholder text using setPlaceHolderText as in the code snippet below (which I invoke from main ). Unfortunately, it is not working as I expected. The code runs, but the text box is blank, does not show the placeholder text. I am in Windows 7, Python 2.7 (working in iPython). class MyTextEdit(QtGui.QWidget): def __init__(self): QtGui.QWidget.__init__(self) self.textEditor=QtGui.QLineEdit(self) self.textEditor

PySide wait for signal from main thread in a worker thread

微笑、不失礼 提交于 2019-12-01 15:31:15
问题 I decided to add a GUI to one of my scripts. The script is a simple web scraper. I decided to use a worker thread as downloading and parsing the data can take a while. I decided to use PySide, but my knowledge of Qt in general is quite limited. As the script is supposed to wait for user input upon coming across a captcha I decided it should wait until a QLineEdit fires returnPressed and then send it's content to the worker thread so it can send it for validation. That should be better than

PyQt: keyPressEvent and keyReleaseEvent - holding press without debounce

匆匆过客 提交于 2019-12-01 13:21:42
问题 I want implement a QDialog , in which a key is pressed for some time (seconds) and is released afterwards. I tried doing this with keyPressEvent and keyReleaseEvent functions. The problem I get is that when a key is pressed the debounce ( keyReleaseEvent ) occurs very quickly, which is not desired in my case. Here, is what I do: def keyPressEvent(self, eventQKeyEvent): key = eventQKeyEvent.key() if key == 54: print('pressed') # 6 def keyReleaseEvent(self, eventQKeyEvent): key = eventQKeyEvent

PDF with QWebView: missing refresh/repaint after loading

妖精的绣舞 提交于 2019-12-01 12:57:28
I use the QWebView (python 3.3 + pyside 1.1.2 + Qt 4.8) as FileViewer. Picture, Text, HTML, ... all fine, but PDF has a display problem. I tested two possible ways. internal pdf viewer: after use webview.load(file) it loads, but the screen is blank, after loading another file, all works fine, it shows the file pdf.js: after use setContent() with filebase, it loads the webviewer.html/.js with a white page and the loading circle. The screen only refresh if I resize the form or use the scrollbars, but then all is fine I don't find an event for "plugin/javascript finished loading", so I could

How to expand top-level QTreeview items

两盒软妹~` 提交于 2019-12-01 11:54:12
问题 I do not understand why this does not seem to expand the top-level root items in a QTreeView: # clear existing treeview data model = self.treeview.model().sourceModel() model.clear() # add treeview items here # expand root level items root = model.invisibleRootItem() index = root.index() for i in range(root.rowCount()): item = model.indexFromItem(model.item(i,0)) self.treeview.expand(item) self.treeview.setExpanded(item, True) print 'expanded' 回答1: If you're using a proxy model, you must use

How do I create a critical error message using PySide?

隐身守侯 提交于 2019-12-01 11:10:45
I seem to be hitting a brick wall. No matter what I do, creating a critical error Message Box just doesn't seem to be working. Here's what I've tried thus far: flags = QtGui.QMessageBox.StandardButton.Abort flags |= QtGui.QMessageBox.StandardButton.Ignore result = QtGui.QMessageBox.critical( self, 'CRITICAL ERROR', 'Error Message', flags ) As taken from this tutorial (old I know, but it's been helpful thus far). Doing this however, brings up the following error: 'PySide.QtGui.QMessageBox.critical' called with wrong argument types: PySide.QtGui.QMessageBox.critical(CreateMessage, str,

pyside / pyqt: simple way to bind multiple buttons that shares the same functionality

一曲冷凌霜 提交于 2019-12-01 09:35:32
I'm new to PyQt / PySide. I have a lot of line edit (for displaying file location) and for each line text I have a push button (to display open file dialog). I have a method: def selectSelf1(self): """ browse for file dialog """ myDialog = QtGui.QFileDialog self.lineSelf1.setText(myDialog.getOpenFileName()) and a push button is binded using the following code self.btnSelf1.clicked.connect(self.selectSelf1) I have about 20 of those buttons and 20 of those line edits. Is there an easy way to bind all of those button to their corresponding line edits rather than typing out everything. Thanks!

PySide passing signals from QThread to a slot in another QThread

拟墨画扇 提交于 2019-12-01 09:23:53
问题 I solved my issue by moving the mySubQThread run() into the myQThread run() That said, I still would like to know why what I was attempting before didn't work. I'm pretty new to threading. I am running into this issue and I think I may be approaching things wrong, anyway here goes. I am open to a different approach I know this may be a bit convoluted to follow. I have a GUI that makes a new derived QThread lets call it myQThread within that thread, I am running through a process that creates