pyside

PySide/PyQt: Execute functions after GUI loads

北慕城南 提交于 2019-12-24 16:42:29
问题 I am building a tiny tool that does file operations at session startup. In order to make sure the user has a visual feedback, I want to associate it with a progress bar. Here I am so far: import sys import time from PySide.QtGui import * class ProgressWindowWidget(QWidget): def __init__(self, parent=None): super(ProgressWindowWidget, self).__init__() self.init_ui() def init_ui(self): self.setGeometry(500, 500, 600, 100) self.setWindowTitle('Progress') self.layout_ = QGridLayout() self

PySide/PyQt: Execute functions after GUI loads

旧城冷巷雨未停 提交于 2019-12-24 16:42:14
问题 I am building a tiny tool that does file operations at session startup. In order to make sure the user has a visual feedback, I want to associate it with a progress bar. Here I am so far: import sys import time from PySide.QtGui import * class ProgressWindowWidget(QWidget): def __init__(self, parent=None): super(ProgressWindowWidget, self).__init__() self.init_ui() def init_ui(self): self.setGeometry(500, 500, 600, 100) self.setWindowTitle('Progress') self.layout_ = QGridLayout() self

Qt: No border on buttons making them non-clickable?

江枫思渺然 提交于 2019-12-24 13:55:53
问题 I'm trying to set a style to a button so that it has no border, but it seems the lack of border then makes the button non-clickable. Is there a better way of getting no border? button = QtGui.QPushButton(todo, self) button.move(0, i * 32) button.setFixedSize(200,32) button.setCheckable(True) button.setStyleSheet("QPushButton { background: rgb(75, 75, 75); color: rgb(255, 255, 255); text-align: left; font-size: 12pt; border: none;}") 回答1: EDIT: WHOOPS, just noticed this is a Question regarding

PySide PyQt MainWindow or Central Widget access from deeply nested widgets

我只是一个虾纸丫 提交于 2019-12-24 11:36:36
问题 Calling out to PyQt gurus for some best practices. I have some application universal attributes that I define as attributes on my QApplication. In my MainWindow initialization I assign an "app" attribute to the MainWindow. I would like to access the app's variables in deeply nested widgets. Right now, I can do so by calling enough "parent()" calls to get up to the level of MainWindow. This seems kludgey and my guess is there is another solution that is best practice in this situation. Here

Python3.3 can't find libpython3.3m.so in linux (pip-3.3)

无人久伴 提交于 2019-12-24 11:29:40
问题 I'm using ubuntu 12.10 with default python3.2. However I downloaded python 3.3 as its much more polished. Of course, since then I have a nightmare with installing modules for 3.3, as python3 packages from synaptic install to 3.2 dir. So, I installed pip using python 3.3. Now I have pip-3.3 command, great. But, when I tried "sudo pip-3.3 install PySide" I quickly got an error: "error: Failed to locate the Python library /usr/lib/libpython3.3m.so". What's more, when I run "sudo pip install

Shiboken cannot be imported

这一生的挚爱 提交于 2019-12-24 10:49:55
问题 Because of issues discussed at this answer, I want to import the shiboken module. When I try import shiboken , I just get an ImportError. But my site-packages directory actually has a Shiboken (capital S) folder, and I am able to import Shiboken fine. Unfortunately, this doesn't have any of the methods the shiboken module is meant to have (e.g., isValid ). Just to verify, when I run Shiboken.isValid() , I get: AttributeError: 'module' object has no attribute 'isValid' . Based on a related

Pyside: Multiple QProcess output to TextEdit

試著忘記壹切 提交于 2019-12-24 10:35:39
问题 I have a pyside app that calls an exectuable. I want to run this executable asynchronously in n processes and capture the output of each process in a QTextEdit. At the moment I have: def run(self, args, worklist): self.viewer = OutputDialog(self) self.procs = [] for path in worklist: final_args = args + path p = QtCore.QProcess(self) p.readyReadStandardOutput.connect(self.write_process_output) self.procs.append(p) p.start(self.exe, final_args) def write_process_output(self): for p in self

QTreeView always displaying the same data

送分小仙女□ 提交于 2019-12-24 07:38:30
问题 I have a tree of items. It is like this: Categorias (root) - General --- Computadoras --- Tablets - Insumos --- Cartuchos The problem is that the QTreeView is being completed always with the same information. I get a tree view looking like this: Categorias (root) - General --- General --- Insumos - Insumos --- General I have put a "print" in the index() method in order to see if the index was being created, and then, when I enter, for example, the "General" category for the first time,

Installing PySide - OSX

人盡茶涼 提交于 2019-12-24 05:18:12
问题 Anyone had success installing and using PySide on OSX? I am following the install instructions on the PySide site, though I'm running into issues building the API Extractor. I run cmake on the CMakeLists.txt file inside the api extractor dir and: This error is thrown- CMake Error at /Applications/CMake 2.8-0.app/Contents/share/cmake-2.8/Modules/FindBoost.cmake:894 (message): Unable to find the requested Boost libraries. Unable to find the Boost header files. Please set BOOST_ROOT to the root

Interrupting QThread sleep

强颜欢笑 提交于 2019-12-24 01:13:04
问题 I would like to know how to pause a QThread and then resume when I get a signal. I have read and know that I can do something like this: def run(self): ... self.ready=False while not self.ready: self.sleep(1) ... ... @QtCore.Slot() def set_ready(self): self.ready = True However, what I want to do is avoid the polling in the thread. I don't want to have to set the sleep to a short amount of time and keep checking. I want to go to sleep until I get a signal from my main thread to continue. What