pyside

QImage to Numpy Array using PySide

别等时光非礼了梦想. 提交于 2019-12-03 03:23:24
I am currently switching from PyQt to PySide. With PyQt I converted QImage to a Numpy.Array using this code that I found on SO : def convertQImageToMat(incomingImage): ''' Converts a QImage into an opencv MAT format ''' incomingImage = incomingImage.convertToFormat(4) width = incomingImage.width() height = incomingImage.height() ptr = incomingImage.bits() ptr.setsize(incomingImage.byteCount()) arr = np.array(ptr).reshape(height, width, 4) # Copies the data return arr However ptr.setsize(incomingImage.byteCount()) does not work with PySide as this is part of the void* support of PyQt. My

connection of Pyside QPushButton and matplotlib

匿名 (未验证) 提交于 2019-12-03 03:03:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I'm trying to develop a very simple pyside/Qt program using matplotlib. I want that a graph is draw when a button is pressed. So far, I can draw something on the constructor, but I can't connect the Pyside event with matplotlib. Is there a way to do that? import sys import platform import numpy as np import PySide from PySide.QtGui import QApplication, QMainWindow, QTextEdit,\ QPushButton, QMessageBox, QWidget, QVBoxLayout from PySide import QtCore __version__ = '0.0.1' import matplotlib matplotlib.use('Qt4Agg') matplotlib.rcParams['backend

Are there default icons in PyQt/PySide?

匿名 (未验证) 提交于 2019-12-03 02:49:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I'm reading a tutorial on PySide and I was thinking , do I need to find my own icons for every thing or is there some way to use some built in icons . That way I wouldn't need to find an entire new set of icons if I want my little gui to run on another desktop environment . 回答1: What you need is Pyside QIcon.fromTheme function. Basicaly it creates QIcon object with needed icon from current system theme. Usage: undoicon = QIcon.fromTheme("edit-undo") "edit undo" - name of the icon "type"/"function" can be found here This works on X11 systems,

Getting started with PySide [closed]

匿名 (未验证) 提交于 2019-12-03 02:45:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I decided to learn Python Gui development and, as PyQt is non-free, the choice was PySide for it. But, unlike PyQt, PySide doesn't have any tutorials or screencasts, just documentation useless for very beginners. I have no Qt experience, so even setting up development environment in Ubuntu is a problem. Could you advice something to learn from? 回答1: If you are going to just learn GUI development with Python, does PyQt not being free really matter? And make sure you actually know the PyQt license before arriving at such a conclusion! There a

Pyside, webkit basic question

拟墨画扇 提交于 2019-12-03 02:41:10
I am currently running this code, and although the web browser appears, the web inspector doesn't seem to display anything, am i doing something incorrectly? import sys from PySide.QtCore import * from PySide.QtGui import * from PySide.QtWebKit import * app = QApplication(sys.argv) web = QWebView() web.load(QUrl("http://www.google.com")) web.show() inspect = QWebInspector() inspect.setPage(web.page()) inspect.show() sys.exit(app.exec_()) It is in the Qt Documentation : Note: A QWebInspector will display a blank widget if either: page() is null QWebSettings::DeveloperExtrasEnabled is false You

PySide / Qt Import Error

匿名 (未验证) 提交于 2019-12-03 02:16:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I'm trying to import PySide / Qt into Python like so and get the follow error: from PySide import QtCore ImportError: dlopen(/usr/local/lib/python2.7/site-packages/PySide/QtCore.so, 2): Library not loaded: libpyside-python2.7.1.2.dylib Referenced from: /usr/local/lib/python2.7/site-packages/PySide/QtCore.so Reason: image not found I'm running/installed via: Mac OSX 10.9.4 Mavericks Homebrew Python 2.7 Homebrew installed Qt Pip installed PySide The file libpyside-python2.7.1.2.dylib is located in the same path as the QtCore.so file listed in

How to make a widget in the center of the screen in PySide/PyQt?

百般思念 提交于 2019-12-03 01:52:47
This code works, but I wonder if there is any simpler way: def center(self): qr = self.frameGeometry() cp = gui.QDesktopWidget().availableGeometry().center() qr.moveCenter(cp) self.move(qr.topLeft()) No, it's the simplest way. Here is a snippet I've used in C++: QRect desktopRect = QApplication::desktop()->availableGeometry(this); QPoint center = desktopRect.center(); move(center.x() - width() * 0.5, center.y() - height()); alrawab just add this line to your main windows : self.move(QtGui.QApplication.desktop().screen().rect().center()- self.rect().center()) self.move(QDesktopWidget()

Pyinstaller: ImportError: cannot import name QtGui

匿名 (未验证) 提交于 2019-12-03 01:48:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: Using the latest pyinstaller on Windows 7 to make a standalone exe (-F), when running the exe: ImportError: cannot import name QtGui In the pyinstaller hooks directory there is special handling for PyQt4 though not PySide. Hoping for a workaround for this or something to try. Environment Windows 7 64-bit Python 2.7 32-bit PYTHONHOME=c:\python27 PYTHONPATH=c:\python27\lib PYTHONLIB=c:\python27\libs\python27.lib;c:\python27\lib\site-packages Steps 1. Add PySide from http://releases.qt-project.org/pyside/1.1.1/PySide-1.1.1qt474.win32-py2.7.exe

Convert numpy array to PySide QPixmap

匿名 (未验证) 提交于 2019-12-03 01:47:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I want to convert an image into a NumPy array to a PySide QPixmap, so I can display it (EDIT: in my PySide UI). I already found this tool: qimage2ndarray , but it only works for PyQt4. I tried to change it to get it working with PySide, but I would have to change the C part of the tool and I have no experience with C. How can I do this or are there any alternatives? 回答1: One alternative is to just use PIL library. >>> import numpy as np >>> import Image >>> im = Image.fromarray(np.random.randint(0,256,size=(100,100,3)).astype(np.uint8)) >>>

PyQt or PySide - which one to use [closed]

核能气质少年 提交于 2019-12-03 01:30:34
问题 Closed . This question is opinion-based. It is not currently accepting answers. Want to improve this question? Update the question so it can be answered with facts and citations by editing this post. Closed 6 years ago . I started learning a bit of python and would now like to toy around a bit with gui-building. Qt seems to be a good choice because of its cross-platformishness. Now there seem to be two bindings available: PyQt by Riverbank Computing and PySide, originally developed by Nokia.