PyQt question

Janos Blazi jblazi at
Mon Sep 17 23:33:29 CEST 2001

I am playing with PyQt on Win2K. I have translated the following small
program from the Qt tutorial into Python:

#include <qapplication.h>
#include <qpushbutton.h>
#include <qfont.h>
#include <qvbox.h>

int main( int argc, char **argv )
    QApplication a( argc, argv );

    QVBox box;
    box.resize( 200, 120 );

    QPushButton quit( "Quit", &box );
    quit.setFont( QFont( "Times", 18, QFont::Bold ) );

    QObject::connect( &quit, SIGNAL(clicked()), &a, SLOT(quit()) );

    a.setMainWidget( &box );;

    return a.exec();

and the translation is

import sys
from qt import *


quit=QPushButton("Quit", box)
#quit.setFont(QFont("Times", 18, QFont.Bold))

Now the problem is that they say in the tutorial:
"The button no longer fills the entire widget. Instead, it gets a "natural"
size. This is because there is now a new top-level widget, which uses layout
management to set a good size and position for the button."

But when I start the program the button is as wide as the entire widget and
even resizing it does not help. Can anybody tell me, why?


-----=  Posted via Newsfeeds.Com, Uncensored Usenet News  =----- - The #1 Newsgroup Service in the World!
 Check out our new Unlimited Server. No Download or Time Limits!
-----==  Over 80,000 Newsgroups - 19 Different Servers!  ==-----

More information about the Python-list mailing list