pyside

Loading animated gif data in QMovie

自闭症网瘾萝莉.ら 提交于 2019-12-08 03:24:23
问题 I'm very new to Qt (specifically PySide) and I'm trying write a script that loads an animated gif from file into a QByteArray and then into a QMovie. The reason for going from file to the QByteArray is because I cannot keep that gif file in memory. I want to be able to store the animated gif in such a way that it can be written out to a JSON file later (hence the QByteArray). I've tried using ekhumoro's answer from here and although no errors showed up, the animated gif also doesn't show up.

How to make QAbstractTableModel 's data checkable

…衆ロ難τιáo~ 提交于 2019-12-08 01:57:07
问题 How to make QAbstractTableModel 's data checkable I want to make each cell in the following code can be checked or unchecked by the user ,how to modify the code ? according to the Qt documentation :Qt::CheckStateRole and set the Qt::ItemIsUserCheckable might be used ,so anyone can give a little sample ? import sys from PyQt4.QtGui import * from PyQt4.QtCore import * class MyModel(QAbstractTableModel): def __init__(self, parent=None): super(MyModel, self).__init__(parent) def rowCount(self,

how to redirect Wheel events of QWidget to QTextEdit

强颜欢笑 提交于 2019-12-08 01:26:19
问题 when you turn the mouse wheel while the mouse is not on the QTextEdit ,the scroll bars will not move in such case ,but I still want to move the scroll bars by mouse wheel ,so how can I implement this function ? I know some software like Microsoft Word have this feature . I implement this feature like the following ,but when you move the scroll bars to the top or bottom by mouse wheel ,an error would occur : maximum recursion depth exceeded while calling a Python object. anyone can help ? my

PySide / wait or sleep

蓝咒 提交于 2019-12-08 01:20:46
问题 i´m new to python and pyside. I´ll try to run the following code with success. But now i want the programm to wait after showing up the window for a defined time where the user can´t use it and then upgrade the statusbar. i´ll tried sleep() but have no idea where it had to be placed the correct way in the code. Thanks for help. #!/usr/bin/python # -*- coding: utf-8 -*- """ ZetCode PySide tutorial This program creates a statusbar. author: Jan Bodnar website: zetcode.com last edited: August

Python/Matplotlib/Pyside Fast Timetrace scrolling

旧时模样 提交于 2019-12-07 20:45:14
问题 I have large time-traces that must be inspected visually, so I need a fast scrolling tool. How can I achieve the fastest Maplotlib/Pyside scrolling? Right know, I added a PySide scroll-bar to a MPL figure and update the x-range of the plot with set_xlim() method. This is not fast enough especially because in the final application I have at least 8 time-traces in different subplots that must all scroll together. A figure of the plot is attached. Is there room for improvement? Here I attach the

Optimising Python QT apps on retina displays

拈花ヽ惹草 提交于 2019-12-07 13:57:54
问题 Qt interfaces currently look horrible on a retina display as they scale up.Its possible to use an Info.Plist for a complied application but does anyone have a solution for dynamic python such as interfaces created in PySide? 回答1: You didn't say what Qt version you're working with. Retina support is best in the latest release, Qt v5.1. but v5.0's is also pretty good. If you're still on Qt v4.8, you'll have to manually apply patches to enable high DPI. High DPI mode is controlled by the

Correct way to address Pyside Qt widgets from a .ui file via Python

老子叫甜甜 提交于 2019-12-07 11:36:54
问题 I have created a GUI with Qt Designer and accessed it via def loadUiWidget(uifilename, parent=None): loader = QtUiTools.QUiLoader() uifile = QtCore.QFile(uifilename) uifile.open(QtCore.QFile.ReadOnly) ui = loader.load(uifile, parent) uifile.close() return ui MainWindow = loadUiWidget("form.ui") MainWindow.show() children = MainWindow.children() button1 = MainWindow.QPushButton1 "children" does already contain the widgets "QPushButton1", "QTextBrowser1" created in the UI but shouldn't the be

Highlight item with mouse hover in QTreeView?

落花浮王杯 提交于 2019-12-07 07:56:57
问题 I have a QStandardItemModel that I am displaying as a QTreeView with multiple columns. How can I make it highlight rows when the mouse hovers over them? Related pages How to catch mouse over event of QTableWidget item in pyqt?: similar question using QTableWidget instead of Q*View . Customizing QListView: suggests it is possible to do it very easily with stylesheets, but I don't quite follow the c++. How to highlight the entire row on mouse hover in QTableWidget QListView selection with

Sharing variable between QWizard pages in Pyside/PyQt

雨燕双飞 提交于 2019-12-07 07:46:18
问题 I am building a QWidget in PySide, and running into an issue when trying to share data between pages. To summarize I utilize user inputs from earlier pages to construct a list of custom objects, which I need to share with the following page. At the beginning of my code I construct a custom object, with an attribute called .name (among other attributes) class MyCustomClass(): def __init__(self, name, other_attributes) self.name = name ...set other attributes In my QWizard I open a file and

Using QtHostinfo.lookupHost in PySide

自古美人都是妖i 提交于 2019-12-07 05:25:29
问题 I am working on a project where I want to confirm the existence of a host on a local network. In the QtNetwork package in Qt, the QHostInfo::lookupHost method is a convenient way of searching for a host without needing to implement any kind of pinging or being dependent on a ping system call. Its asynchronous call makes it convenient to create a dialog waiting for the call to return with a slot in either the dialog or the main program to handle the return. From Qt's Documentation for