Please I downloaded the latest version of python QT but I've been unable to use because i don't know how, help from the experts in the house.

Thanks in advance

Will check and get back to you.

I assume you are using the Windows OS and Python 3.2, simply do this ...

For PyQT download and run the Windows 32 bit self-extracting installer

Py3.2 indicates that this the installer for Python 3.2, there are installers for other versions of Python too.

You can copy, click on (Toggle Plain Text) first, and paste the typical PyQT code below and run it from an IDE like IDLE that comes with your Python installation ...

# use PyQT to draw a simple vertical bar chart
# tested with PyQT4.8 and Python3.2

from PyQt4.QtCore import *
from PyQt4.QtGui import *

class BarChart(QWidget):
    def __init__(self, data, parent=None):
        # create the window (will be instance self)
        QWidget.__init__(self, parent)
        # setGeometry(x_pos, y_pos, width, height)
        self.setGeometry(300, 300, 360, 320)
        self.setWindowTitle('Simple Bar Chart') = data

    def paintEvent(self, event):
        painter = QPainter()
        # set color and width of line drawing pen
        painter.setPen(QPen(, 2))
        # drawLine(x1, y1, x2, y2) from point (x1,y1) to (x2,y2)
        # draw the baseline
        painter.drawLine(20, 280, 340, 280)        

        # set up color and width of the bars
        width = 20
        painter.setPen(QPen(, width))
        delta = width + 5
        x = 30
        for y in
            # correct for width
            y1 = 280 - width/2
            y2 = y1 - y + width/2
            # draw each bar
            painter.drawLine(x, y1, x, y2)
            # add values to the top of each bar
            s = str(y)
            painter.drawText(x-8, y2-15, s)
            x += delta        


# data to be graphed
data = [30, 45, 80, 150, 220, 180, 110, 75, 50, 35, 20, 10]
app = QApplication([])
bc = BarChart(data)

For some helpful hints on IDLE see:

Thanks a million.

Tested with PySide, worked by only changing PyQT4 to PySide.

It did not like IDLE though, giving nothing more serious than crash reports, but directly running from command line was OK.

Okay but what is pyside.

It is alternative for PyQT which has no limitations for commercial use (LGPL), I sent one announcement resently to Python forum, when I realised it came out. PyQT has two licence models GPL, which is free for non-commercial use, and other by payment for commercial development.
LGPL: Pyside bindings for QT released!

Okay will check it out.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.