Reusable Code Snippet A Simple PySide Digital Clock
PySide (public license PyQT) is my preferred Python GUI toolkit. Here we explore how to test some of the widgets available and create a digital clock.
|+3 forum 2|
Reusable Code Snippet Applying PySide's QAbstractTableModel
Using PySide's QAbstractTableModel allows you to easily customize a widget like QTableView and make it more generic in its application. Here we use it to present solvent data in tabular form and sort each column content by simply clicking on the header. You can feed it any data as long as you stick to the format of the data used, a header list and a list of data tuples/lists.
|+4 forum 7|
Reusable Code Snippet PLAY animated GIF files with PySide
Use the PySide (PyQT) GUI toolkit to play animated gif files.
|+3 forum 1|
Reusable Code Snippet Rotate Text (PySide)
Just the very basics on how to draw a rotated text using the Python GUI toolkit PySide (public PyQt). Please experiment and embellish.
|+2 forum 2|
Reusable Code Snippet Play Wave Sound Files with PySide/PyQT
The PySide (PyQT) GUI toolkit can be used to play wave sound files.
|+1 forum 1|
I have made a QTableView that displays images from disk, there are two seriously agonizing problem I am facing. First of after the windows shows up making it maximize or changing size of window is very slow, and secondly I want to display images height width dependong on what can fit in the full window size of the maximized window keeping the aspect size of the thumbnails. Right now Images dont fit properly and text is getting displayed on left while i want it to display at bottom of the image. import sys import os from PyQt4 import QtGui, QtCore …
|+0 forum 0|
How do I display images in QListView of size of standard thumbnail size like 250 x 200 , and file nametext should wrap to next line , right now the images displayed are very small and are not positioned under each other in proper row column order. import sys import os from PyQt4 import QtGui, QtCore class MyListModel(QtCore.QAbstractListModel): def __init__(self, datain, parent=None, *args): """ datain: a list where each item is a row """ QtCore.QAbstractListModel.__init__(self, parent, *args) self.listdata = datain def rowCount(self, parent=QtCore.QModelIndex()): return len(self.listdata) def data(self, index, role): if index.isValid() and role == QtCore.Qt.DecorationRole: return QtGui.QIcon(QtGui.QPixmap(self.listdata[index.row()])) if index.isValid() and …
|+0 forum 4|
Reusable Code Snippet Make e-mail text more secure (PyQT/PySide)
Using the PySide GUI toolkit will make selecting, copying and pasting encrypted and decrypted text somewhat easier. Not ideal yet, but it will be a good start for those of you who are not very familiar with GUI programming.
|+2 forum 1|
I recently made an appication that utilizes pyqt , i could say i wrote the code pythonic and made everything work work as I wanted, but didnt used any data model , so later I realized I could have used data model since I am building list in the QListView of task that will be performed in batch. So how do to decide what data model to use & when ? I have found so many things in PyQt that could be an alternative to pythonic code... so what do I need to learn about data models in PyQt or …
|+0 forum 2|
Reusable Code Snippet Exploring the PySide Label
A small test program exploring the PySide/PyQT Label widget. With HTML code you can do some nice formatting of the label's text.
|+5 forum 0|
Reusable Code Snippet Testing the PySide Validator
The PySide/PyQT QValidator restricts the type of input a widget like QLineEdit can accept. Here is a simple test.
|+1 forum 0|
Reusable Code Snippet Pyside GroupBox StyleSheet
This PySide (PyQT) code sample shows you how to apply a StyleSheet to a GroupBox containing a number of RadioButtons.
|+3 forum 0|
from PySide import QtCore,QtGui import sys class ToolBarUI(QtGui.QMainWindow): def __init__(self,*args,**kwargs): super(ToolBarUI,self).__init__(*args,**kwargs) self.floatingToolBar() pass def buttons(self): self.btnVLay=QtGui.QVBoxLayout() self.incSavbtn=QtGui.QPushButton("Save") self.emailbtn=QtGui.QPushButton("Email") self.upldbtn=QtGui.QPushButton("Upload") self.setPrjbtn=QtGui.QPushButton("Set Project") self.setThumb=QtGui.QPushButton("Set thumb") self.shwMatbtn=QtGui.QPushButton("Show Material") self.fixtexbtn=QtGui.QPushButton("Fix Texture Paths") btns = [self.incSavbtn,self.emailbtn,self.upldbtn,self.setPrjbtn,self.setPrjbtn,self.setThumb,self.shwMatbtn,self.fixtexbtn] [self.btnVLay.addWidget(each) for each in btns] def floatingToolBar(self): self.buttons() self.setLayout(self.btnVLay) self.show() pass if __name__ =='__main__': app = QtGui.QApplication(sys.argv) app.setStyle("cleanlooks") win = ToolBarUI() win.floatingToolBar() sys.exit(app.exec_()) why the above code is showing an empty window , I am trying to stack buttons in VBoxLayout().. any idea what am i forgetting ?
|+0 forum 6|
The UI is as following . http://img.my.csdn.net/uploads/201211/03/1351957960_1171.jpg What I want is : When I press the Enter key ,the label should shows “Enter” When I press The blank space key ,the label should shows “space” How to implement this ? I know I should reimplement the keyPressEvent handler ,but I guss I was got stuck by the focus
|+0 forum 1|
To display system clock time in LCD format I just want to display system clock time in LCD format, also want the time to be displayed with the format of hh:mm:ss ,my code is as following ,but when I run it ,it is out of my expectaions ，so anyone can explain why ? import sys from PySide import QtGui, QtCore class Example(QtGui.QWidget): def __init__(self): super(Example, self).__init__() self.initUI() timer = QtCore.QTimer(self) timer.timeout.connect(self.showlcd) timer.start(1000) self.showlcd() def initUI(self): self.lcd = QtGui.QLCDNumber(self) self.setGeometry(30, 30, 800, 600) self.setWindowTitle('Time') vbox = QtGui.QVBoxLayout() vbox.addWidget(self.lcd) self.setLayout(vbox) self.show() def showlcd(self): time = QtCore.QTime.currentTime() text = time.toString('hh:mm') self.lcd.display(text) def main(): …
|+0 forum 2|
i finally started having a look at gui yesterday, and tried to do some things with PySide, however i have the following problem; Whats wrong with this code? [CODE] !/usr/bin/python # -*- coding: utf-8 -*- import sys from PySide.QtCore import * from PySide.QtGui import * class Form(QDialog): def __init__(self, parent=None): super(Form, self).__init__(parent) # Create widgets self.edit = QLineEdit("Write my name here") self.button = QPushButton("Show Greetings") # Create layout and add widgets layout = QVBoxLayout() layout.addWidget(self.edit) layout.addWidget(self.button) # Set dialog layout self.setLayout(layout) # Add button signal to greetings slot self.button.clicked.connect(self.greetin… # Add button signal to exit slot exit_button = QPushButton("Exit") exit_button.clicked.connect(sys.exit) …
|+0 forum 3|
Hi, I've posted two scripts that I would like to improve. The first one (SparePartsDemo.py) is a little utility that takes a .csv (.txt) data file exported from another application, builds a SQLite database,performs a request to select and sort records and write the results to a sqlite database file, a .csv file, a .xls file and barcode labels to a .pdf file. I want to change the way I build my date acquisition and my query string (lines 482 to 520 and 580 to 989) to a GUI style. I've been using PySide (Qt) for making an attempt to …
|+0 forum 0|