pyside

Centre widget on parent widget without layout

穿精又带淫゛_ 提交于 2019-12-08 12:06:12
问题 I am adding a widget to a parent widget without the use of a layout (because I'm using some animations that conflict with what the layout try to do). I am trying to understand what I need to do to align the child widget to it's parent manually (centre it horizontally and vertically even when the parent widget is resized). I've tried calculating the position myself and using QWidget.move() and QWidget.setGeometry() , but neither worked properly as I seem to be unable to get the correct parent

PySide QtCore.Slot decorator does not work with self.sender() inside a method

依然范特西╮ 提交于 2019-12-08 11:20:50
问题 I came across this weirdness in using PySide Slot decorator. If I decorate my method using QtCore.Slot and if I try to access self.sender() inside the method, I get None. If I remove the QtCore.Slot() decorator. I get the sender properly. Here is a minimal example. import sys from PySide.QtCore import * from PySide.QtGui import * class Worker(QObject): def init(self): print "worker is ready." @Slot() def work(self): print "i am tired, %s" % self.sender() app = QApplication(sys.argv) button =

How to create a treeview of checkboxes?

眉间皱痕 提交于 2019-12-08 09:50:30
问题 How to create a tree view, while each item on the is checkbox in pyside? The tree items are dictionary that look like the example below: A: 1: 1.1: 1.1.1 1.1.2 1.2: 1.2.1 1.2.2 2: 2.1 2.1.1 2.1.2 B ... 回答1: Try this: import PyQt4.QtGui as gui import PyQt4.QtCore as core dat = { 'A': { '1': {'1.1': ['1.1.1', '1.1.2'], '1.2': ['1.2.1', '1.2.2'] }, '2': {'2.1': ['2.1.1','2.1.2']} } } def add(p,ch): if isinstance(ch,dict): for k,v in ch.iteritems(): item = gui.QTreeWidgetItem(p) item.setText(0, k

View QStandardItemModel with column of checkboxes in PySide/PyQt?

萝らか妹 提交于 2019-12-08 08:12:29
问题 I have a QTreeView of a QStandardItemModel , and want one column to be checkboxes only (no text, just checkboxes). This has been discussed for QAbstractItemModel . I have tried to implement the solution there (see SSCCE below), but only a single checkbox shows up, in the first row of the view. I am not sure what extra magic needs to be added for the checkbox to show up in every row. Note, as discussed at this related question, I want a column of checkboxes with no text fields , so simply

PySide's shiboken python module not found

∥☆過路亽.° 提交于 2019-12-08 07:33:49
问题 PySide is installed successfully, and it works perfectly, but I can't find a way to import the shiboken module. Now I found the discussion about the feature request to expose shiboken functions through a python module (http://bugs.pyside.org/show_bug.cgi?id=902), but the issue is resolved. It was implemented in january 2012, if I understood correctly. Even though after the installation of PySide 1.1.1 when I try: >>> import shiboken Traceback (most recent call last): File "<stdin>", line 1,

Ghost.py and proxy

南楼画角 提交于 2019-12-08 06:47:55
问题 Is anyone able to explain how to make Ghost.py work with a proxy? I've checked out the code but it's not there. 回答1: I've found it in the ghost.py file. They did a very good job in it. It's a method on line 835, as set_proxy(). It's just how to use it that I'm yet to try out: def set_proxy(self, type_, host='localhost', port=8888, user='', password=''): """Set up proxy for FURTHER connections. :param type_: proxy type to use: \ none/default/socks5/https/http. :param host: proxy server ip or

installing pyside using PIP - nmake not found

℡╲_俬逩灬. 提交于 2019-12-08 06:15:12
问题 I want to install PySide using PIP package manager. But it get this error message saying it didn't find nmake. This is no surprise because I do not have MSVC installed nor do I intend to. Installing collected packages: pyside Running setup.py install for pyside Removing c:\users\cnyffele\appdata\local\temp\pip_build_cnyffele\pyside\pyside_package Python architecture is 32bit nmake not found. Trying to initialize the MSVC env... Searching MSVC compiler version 9.0 error: Failed to find the

How to get QThreads to work in a console PySide program?

我怕爱的太早我们不能终老 提交于 2019-12-08 05:44:11
问题 I'm trying to learn how to use threading in a python program. I'm using PySide and QThreads since I'm going to implement gui afterwards with PySide. I have understood the main consept of threading, at least I think. But I'm still confused with event loops. And I think that is the problem with my aplication. Here is a sample application that I can't get to work properly. In my main class I have several worker threads and I want to them to report their progress to the main main class. But the

I need help on taking a flash webvideo screenshot on Pyside or PyQt4

妖精的绣舞 提交于 2019-12-08 04:13:14
问题 i have an issue on taking a screenshot of the youtube video page. in Pyside i have enabled flash function using below command to play video on Pyside browser s.setAttribute(QWebSettings.PluginsEnabled, True) s.setAttribute(QWebSettings.JavascriptEnabled, True) now my script can open video embedded website and playing videos but when i tried to capture screenshot it showing Black screen on video embedded place. Script: #!/usr/bin/env python #-*- coding:utf-8 -*- from PySide.QtCore import Qt,

How to add a tab in PySide

梦想与她 提交于 2019-12-08 03:49:20
问题 I am trying to add tab for 2 grid layout, but when I ran the code it seems like there is no tab. I think wid_inner.tab = QtGui.QTabWidget() is not adding the tab correctly to the grid import sys from PySide import QtGui if __name__ == "__main__": app = QtGui.QApplication(sys.argv) # setting the outter widget and layout wid = QtGui.QWidget() grid = QtGui.QGridLayout() wid.setLayout(grid) # setting the inner widget and layout grid_inner = QtGui.QGridLayout() wid_inner = QtGui.QWidget() wid