pyside

Semi-transparent highlights using PySide and QTextEdit

不羁的心 提交于 2019-12-02 07:09:24
问题 I've created a QTextEdit object. The code below adds randomly colored highlights to the currently selected text. I need the highlights to be semi-transparent so I can see highlights layered upon each other. Using "setAlpha" does not appear to do anything. How can I set the alpha for the highlight or otherwise obtain semi-transparency? # Define cursor & span self.cursor = self.textdoc.textCursor() self.selstart = self.cursor.selectionStart() self.selend = self.cursor.selectionEnd() self

PyQt4 + matplotlib in a QScrollWidget

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-02 07:07:12
问题 I have matplotlib embedded in a PyQt4 app that I'm working on. The problem is when I dynamically add a subplot to the figure, the figures compress with every added subplot. I thought I could solve this by setting the figure to a QScrollArea but that doesn't work (as far as I can tell). Here's an example of what I thought would work import os os.environ['QT_API'] = 'pyside' from PySide.QtGui import * from PySide.QtCore import * import matplotlib from matplotlib.backends.backend_qt4agg import

pyside-rcc “dyld: Library not loaded:…”

寵の児 提交于 2019-12-02 06:54:58
I'm a python and Qt rookie and I have some problems running pyside-rcc (and pyrcc4). The problem is not the link to the executable but a library problem it seems. That I'm not a unix wizard, probably doesn't help either:) When I run $ pyside-rcc i get the following error dyld: Library not loaded: @rpath/lib/QtCore.framework/Versions/4/QtCore Referenced from: /Users/[USERNAME]/Library/Enthought/Canopy_64bit/User/bin/pyside-rcc Reason: image not found Trace/BPT trap: 5 For $ pyrcc4 the error is similar but not exactly the same: dyld: Library not loaded: @rpath/lib/QtXml.framework/Versions/4

Python- help('modules') unexpected behaviour

情到浓时终转凉″ 提交于 2019-12-02 06:50:18
问题 I've been playing with QT and python using PySide. I've just done one of the basic tutorials . I've closed down python and restarted another session and now whenever I try to list the modules using help('modules') the button tutorial runs. If I close the window python crashes. The top of the error message is Process: Python [2005] Path: /Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python Identifier: org.python.python Version: 2.7.3 (2.7.3) Code Type:

How to modify style hint without QProxyStyle?

元气小坏坏 提交于 2019-12-02 06:48:58
I use Python bindings of Qt (PySide or PyQt4). They don't have QProxyStyle . I want to change the value of a style hint. For example change the SH_Menu_SubMenuPopupDelay popup delay time of a submenu. In native C++ Qt I would use a QProxyStyle and override styleHint and filter for the style hint of interest and return the value I like. It's done here for example. But in the Python bindings I use QProxyStyle is not available. So how can a style hint of an existing style be modified there? The menu popup delay is not a fixed value, as it will depend on the current style. There is no way to set

QComboBox with autocompletion works in PyQt4 but not in PySide

試著忘記壹切 提交于 2019-12-02 06:19:58
I've got a combo box with a custom completer that worked fine in PyQt4, but isn't working in PySide. I have verified that the new completer is replacing the QComboBox's built in completer because inline completion is no longer occurring. However when run with PySide, the completer doesn't popup with a filtered list of options. I've also tried ensuring that all text is all str or all unicode to avoid differences between the PyQt API 1 with QStrings and PySide's use of Python unicode types. Changing the text types has had no effect on either PyQt or PySide's behavior (PyQt keeps working, PySide

How to show image to PYQT with opencv

人走茶凉 提交于 2019-12-02 05:59:48
Hello I'm new in python and opencv I want to ask, how to show my image in qlabel (pyqt) and i want to convert qlabel to grayscale. import sys from PyQt5.uic import loadUi from PyQt5.QtWidgets import QMainWindow, QApplication, QFileDialog import cv2 from PyQt5 import QtCore, QtGui, QtWidgets from PyQt5.QtGui import * from PyQt5.QtCore import * class UIProgram(QMainWindow): def __init__(self): super(UIProgram,self).__init__() loadUi("Backpro2.ui",self) #self.image=None self.trainLoadImgBtn.clicked.connect(self.loadClicked) self.image = QImage() @pyqtSlot() def loadClicked(self): fname,filter

migrating from Inherited QThread to Worker model

允我心安 提交于 2019-12-02 05:59:23
问题 So through a lot of help in my previous questions (Interrupting QThread sleep and PySide passing signals from QThread to a slot in another QThread) I decided to attempt to change from the inherited QThread model to the Worker model. I am thinking I should stay with the QThread model as I had that working, and the other model is not. However I am not sure why the Worker model isn't working for me. I am attempting to do this please let me know if there is something inherently wrong in my

pyside - how to delete widgets from gridLayout

孤街浪徒 提交于 2019-12-02 05:32:02
问题 I built a ui in QT Designer and then used pyside-uic turned it into a python file and have then written some code to edit it programmatically. In otherwords I have a pushbutton Add Row that when clicked will rename itself to Remove1 and create another pusbutton name it Add Row and add it to the layout. Code when clicking Add Row , changes the name and the signals/slots: self.pb_Row[-1].setText('Remove'+str(self.nRows)) self.pb_Row[-1].clicked.disconnect( self.addRow ) self.pb_Row[-1].clicked

How to get value from QDialog using multiple class

耗尽温柔 提交于 2019-12-02 05:24:07
I am currently working in a panel in Nuke 11 that opens a QDialog and I was wondering how to get a value from it into my main class when I close my QDialog ? The QDialog is in a different class. This is a simplified example that shows my problem : import nuke from nukescripts import panels try: ## < Nuke11 import PySide.QtGui as QtGui import PySide.QtCore as QtCore except: ## >= Nuke11 import PySide2.QtCore as QtCore import PySide2.QtGui as QtGui import PySide2.QtWidgets as QtGui from PySide2.QtWidgets import QWidget as QWidget class Example(QtGui.QWidget): def __init__(self): super(Example