Newbie question: PyQt & Form::init()
Diez B. Roggisch
deets at nospam.web.de
Mon Sep 25 16:04:32 CEST 2006
Sven Ehret wrote:
> Diez B. Roggisch wrote:
>> Sven Ehret wrote:
>>> Hello List,
>>> I am trying to learn Python and followed the tutorial at
>>> http://www.cs.usfca.edu/~afedosov/qttut/. Being happy that it works, I
>>> am now trying to do my own project, but I am having problems with
>>> initialization of my form.
>>> I want to automatically fill a couple of comboboxes upon starting the
>>> program. I read on the net that I simply have to add a function
>>> called »Form1.Init()« with the content I wish to have executed at start
>>> time. However, it never gets executed, so it seems. When I re-write the
>>> application to have the code executed at the press of a button, it
>>> works. What am I doing wrong?
>> Show us more code, and we show you the problem. At least we can try then,
>> until someone finally implements
>> from __future__ import mindreading
> Oh, sorry. *blush*
> here is my code (two files):
> # -*- coding: utf-8 -*-
> # Form implementation generated from reading ui file 'form1.ui'
> # Created: Mo Sep 25 15:38:56 2006
> # by: The PyQt User Interface Compiler (pyuic) 3.14.1
> # WARNING! All changes made in this file will be lost!
> from qt import *
> class Form1(QDialog):
> def __init__(self,parent = None,name = None,modal = 0,fl = 0):
> if not name:
> self.pushButton1 = QPushButton(self,"pushButton1")
> self.comboBox1 = QComboBox(0,self,"comboBox1")
> self.comboBox2 = QComboBox(0,self,"comboBox2")
> self.buttonGroup1 = QButtonGroup(self,"buttonGroup1")
> self.pushButton3 = QPushButton(self,"pushButton3")
> self.textLabel1 = QLabel(self,"textLabel1")
When you just invoke
here, things should work.
More information about the Python-list