pyside

Ghost.py not finding PySide?

匿名 (未验证) 提交于 2019-12-03 01:22:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I'm trying to get started with the Ghost.py headless browser on a Mac. I installed Ghost.py and its dependencies using these links/commands: Qt 5.0.1 for Mac , has a GUI installer PySide 1.1.0 , which requires Qt Version >= 4.7.4 , has a GUI installer sudo pip install Ghost.py I launched Python, and confirmed that I can import PySide . However, when I do from ghost import Ghost , it fails to find PySide : Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2

Installed PySide but can&#039;t import it: “no module named PySide”

匿名 (未验证) 提交于 2019-12-03 00:59:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I'm new to Python. I have both Python 2.7 and Python 3 installed. I just tried installing PySide via Homebrew and got this message: PySide package successfully installed in /usr/local/lib/python2.7/site-packages/PySide... Both versions of Python and the newly installed PySide are all stored in /usr/local/Cellar/ . This issue is that when I'm in either Python 2.7 or Python 3 and try to import PySide or run a test program that includes PySide, I get the message: "no module named PySide". This is on OS X 10.9.3 Any help would be greatly

pyside qtreewidget constrain drag and drop

只愿长相守 提交于 2019-12-03 00:36:42
I'm trying to add a constraint to the QTreeWidget drag and drop function to prevent the branches from entering another branch in another root. Here's an example to make things more clear: I have 4 objects. Lets call them apple, banana, carrot, durian. The tree looks like this: isDelicious (Root) |-- BackgroundObjects (Branch) |-- Durian |-- ForgroundObjects (Branch) |-- Apple |-- Banana |-- Carrot isSmelly (Root) |-- BackgroundObjects (Branch) |-- Apple |-- Carrot |-- ForgroundObjects (Branch) |-- Banana |-- Durian So, the objects are allowed to be dragged and dropped from BackgroundObjects to

How to plot on my GUI

只谈情不闲聊 提交于 2019-12-02 23:48:24
I'm designing a GUI with PyQt where I need to display a matplotlib/pylab window when I click on a button that makes the plot of the data from a function I've created. It's like a runtime used in Matlab. I want to keep the matplotlib/pylab window as my window everytime I press that button. Here is a basic example that will plot three different samples using a QThread : #!/usr/bin/env python #-*- coding:utf-8 -*- import random from matplotlib.backends.backend_qt4agg import FigureCanvasQTAgg from matplotlib.figure import Figure from PyQt4 import QtGui, QtCore class MatplotlibWidget(QtGui.QWidget)

PyQt (PySide), WebKit and exposing methods from/to Javascript

雨燕双飞 提交于 2019-12-02 22:19:59
I am planning to use PyQt to control an embedded WebKit browser on the server side. I have some inherit application logic in Javascript in the HTML page running inside WebKit. How could I communicate from the host process (Python, PyQt) with Javascript, so that I can call Javascript functions inside the page Python methods are exposed to Javascript and can be called from the Javascript, with arguments The following source code should be helpful: import sys from PyQt4.QtCore import QObject, pyqtSlot from PyQt4.QtGui import QApplication from PyQt4.QtWebKit import QWebView html = """ <html> <body

Why is super used so much in PySide/PyQt?

戏子无情 提交于 2019-12-02 22:08:09
Short version (tl;dr) I am learning PySide, and most online tutorials use super to initialize UI elements. Is this important (i.e., more scalable), or is it a matter of taste? Clarification : as I make more clear in the detailed version, this is not another generic thread asking when to use super (this has been done before). Rather, given the number of PySide tutorials that use super instead of <class>.__init__ , I am trying to figure out if using super is standard in PySide applications? If so, is it because the circumstances where super is called for (involving resolving inheritances) come

Are there default icons in PyQt/PySide?

China☆狼群 提交于 2019-12-02 20:23:27
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 . Paweł Jarosz 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, for MacOSX and Windows check QIcon

Communication between threads in PySide

[亡魂溺海] 提交于 2019-12-02 18:21:04
I have a thread which produces some data (a python list) and which shall be available for a widget that will read and display the data in the main thread. Actually, I'm using QMutex to provide access to the data, in this way: class Thread(QThread): def get_data(self): QMutexLock(self.mutex) return deepcopy(self.data) def set_data(self, data): QMutexLock(self.mutex) self.data = deepcopy(data) def run(self): self.mutex = QMutex() while True: self.data = slowly_produce_data() self.emit(SIGNAL("dataReady()")) class Widget(QWidget): def __init__(self): self.thread = Thread() self.connect(self

Deleting and Redrawing Matplotlib Animation

无人久伴 提交于 2019-12-02 14:58:00
问题 There are a few parts to this problem, so let me summarize. I'm trying to be able to create an animation in a PySide window, and then later destroy and reanimate it based on new information. I've created a sample script to demonstrate this, but it's a bit long, so here's an outline: Create a QtGui main window using PySide Create a widget in the window for drawing the animation Animate the widget using FuncAnimation On a button press: Delete the widget and animation Recreate the widget using

Assign string to QLineEdit with PySide/PyQt

别来无恙 提交于 2019-12-02 14:54:14
I'm having a little bit of trouble assigning values to a QLineEdit. I've read the documentation and feel that the QLineEdit.SetText() command will be used at some point. I've used Qt Designer to design a GUI for my software. On the main window (MainWindow.py, with an accompanying ui_MainWindow.py setup file), I have a LineEdit (lineEditScanBarcode) which has strong focus. I've managed to pull input from that LineEdit pretty well. What I'd like to do is this: If the input in LineEditScanBarcode = x, then assign the name 'John Smith' to a secondary QLineEdit (lineEditUser) which has a zero focus