background preloader

PyQt4

Facebook Twitter

ScoreBoard and ClockTimer Widget For Games. How To Connect A HTML Link From QTextBrowser To A Method. Sending Customized Signals Thru PyQt. Primeros Pasos en PyQt4. MasterMind Board Game With GUI In Python PyQt QTimer!!!!!!!!!! Making PyQt4 widgets with SIP. SIP is a tool for making a Python API for C and C++ libraries, and it is used to make PyQt.

Making PyQt4 widgets with SIP

Both packages we will find in many Linux distributions. SIP has a documentation - for Qt3, or "look at python qscintilla bindings" :) But with the help of Phil and Google I've came up with a working solution for making PyQt4 widgets from Qt4 widgets. To make a PyQt4 API we need the widget header file - like QLabel.h, and the libraries it "depends" on.

When we have that file we will have to create few extra: afile.sip - file named (recommended) like the header file. Making QTermWidget PyQt4 API As a example I've selected from qt-apps.org a nice widget - QTermWidget. Now we have to make a qtermwidget.sip file, that will describe what SIP should wrap. Next stage is the config file. config.py looks like this: It's mostly a generic file, and for other projects like this only the name "qtermwidget" should changes. If we have all the configuration done we can finish our work by compiling the API. Programming/python/PyQt - PukiWiki. What is PyQt? PyQt is a set of Python v2 and v3 bindings for Digia's Qt application framework and runs on all platforms supported by Qt including Windows, MacOS/X and Linux.

What is PyQt?

PyQt5 supports Qt v5. PyQt4 supports Qt v4 and will build against Qt v5. The bindings are implemented as a set of Python modules and contain over 620 classes. Digia have announced that support for Qt v4 will cease at the end of 2015. PyQt5 and Qt v5 are strongly recommended for all new development. PyQt is dual licensed on all supported platforms under the GNU GPL v3 and the Riverbank Commercial License. PyQt does not include a copy of Qt. PyQt Components A description of the components of PyQt5 can be found in the PyQt5 Reference Guide. A description of the components of PyQt4 can be found in the PyQt4 Reference Guide. Why PyQt? PyQt brings together the Qt C++ cross-platform application framework and the cross-platform interpreted language Python. Primeros pasos en PyQt4. Introduction to PyQt4 toolkit. HomeContents This is an introductory PyQt4 tutorial.

Introduction to PyQt4 toolkit

The purpose of this tutorial is to get you started with the PyQt4 toolkit. The tutorial has been created and tested on Linux. EL Tutorial. Home > Python and PyQt4 > Introduction to PyQt4 Creating an application in PyQT4 may be done in a few ways.

EL Tutorial

The most common one is to use QTDesigner, which we get with QT. QTDesigner let us draw the GUI which is very handy for complicated interfaces. We can place widgets on the window, add names etc. To create an application in PyQT4 you have to: Create the GUI in QTDesignerSet names in the Property Editor to ease coding of the application (QTDesigner)Using pyuic4 create the python GUI classCall the application using that GUI classExtend it with our own slotsWhen you use a widget you go to PyQt's Classes and check methods of each used widgets. Tutorials List Introduction. Tutorial de desarrollo de aplicaciones con interfaz grafica en Python y Qt (PyQt) - I.

Tenemos que romper una regla de oro importante que era, NO TOCAR los autogenerados.

Tutorial de desarrollo de aplicaciones con interfaz grafica en Python y Qt (PyQt) - I

Bueno, pues en esta ocasion vamos a tocar el autogenerado. En concreto le vamos a añadir un par de lineas. Para empezar arriba del todo hacemos accesible el dialogo para la pantalla principal from pydanirc.dialogs.dlgAlgo import dlgAlgo Algo mas abajo, como ultima linea del setupUi de la ventana principal conectamos la opcion del menu con una funcion que nos lance el dialogo cuando sea necesario. self.connect(self.actionOpcion1, QtCore.SIGNAL("triggered()"), self.abreDlgAlgo) para acabar creamos la funcion (metodo para hablar con mas propiedad) que lanzara el dialogo def abreDlgAlgo(self): Creación de una calculadora con Python y PyQt4. Introducción:Vamos a emprender la "aventura" de crear una calculadora.

Creación de una calculadora con Python y PyQt4

Python nos va a ayudar con su introspección y sus tipos de datos diccionario, lista y tupla; Qt nos va a dar una mano con sus mecanismos de conexión y algunas propiedades útiles que define en su clase base principal, QObject.Por último, y para hacer menos aburrido el tema, usaremos un autómata finito (aka. maquina de estados) para emular el comportamiento de esas calculadoras económicas de bolsillo, desarrolladas en algún país del este...Diseño de la interfase:Para esto, utilizaremos el diseñador de Qt, en Debian el binario se llama designer (o designer-qt4 si se tiene Qt3 y Qt4 instalados).Es una buena oportunidad de usar los layouts, en especial, uno que no usamos a menudo, el layout matricial, o de celdas (QGridLayout).Luego de jugar un rato, podremos hacer algo como lo siguiente: Donde hemos definido los nombres de los objetos, respetando un patrón, en este caso, los digitos, se llaman btn_digit_ automata = {

PyQt4 - primer ejemplo. Home > Python and PyQt4 > Simple text editor in PyQT4 We want to make a simple text editor (viewer at start).

PyQt4 - primer ejemplo

So in QTDesigner we create a GUI based on "Main Window". I used two PushButtons and one TextEdit: The "Close" button I've connected with the window assigning "close()" slot which will close the GUI. For the "Open File" button I've changed it objectName to "button_open", and for the TextEdit window to "editor_window", and the window name from "MainWindow" to "notepad". I've saved the GUI and made a Python class out of it: