[PyKDE] Newbie: Initiate

Hans-Peter Jansen hpj at urpla.net
Sun Feb 12 12:42:11 GMT 2006


Am Sonntag, 12. Februar 2006 03:39 schrieb Kuljo:
> Hi Mikhail,
> thanks for your contribution. But I think, I did not
> described my problem clear enough:
> I have a kListBox1 which I want to fill with the names of
> the directories out of a higher level directory. For this
> purpose I have made a slot in the .ui.h file:
>
>     void MyBrain::listChapters()
>     {
>
> self.kListBox1.insertStrList(listdir(getenv('HOME')+'/.mybrain'))
>     }

In one word: Don't! Designer is really the BADEST python development 
environment available. Don't do this in designer at all.

Create your UI in designer. Create another python module, import and 
subclass your UI module (eric has an option in the context menu of UI 
modules for exact this purpose). Now you have maximum control about 
your UI, and does your real work in powerful development environment 
with all powers at your hand.

> Now, the problem is, how should I activate this slot (which
> works fine) without any user interaction so, that as soon as
> the form starts up the listbox is already filled with data.
> Sure, if I introduced a button and a connection e.g.
>
>     pushButton1 clicked() MyBrain listChapters()
>
> it does work swell. But it is, what I don't want.
> I'm looking for a signal, which triggers this action
> earliest at the creating of the kListBox1 but latest the
> form is presented to the users.

No, you aren't looking for a signal, you're looking for the polish 
method. Don't forget to call the polish baseclass method and be aware, 
that Qt may call polish more than once..

> Kind regards Lajos

BTW Lajos, it would be nicer for us, if you configure your MUA to 
display your full name. 

Regards,
Pete




More information about the PyQt mailing list