[PyQt] Newbie questions: Tray system and other stuff...

David Boddie david at boddie.org.uk
Tue Jul 17 01:23:33 BST 2007


On Saturday 14 July 2007 02:37:26 -0300, Gustavo A. Dí­az wrote:

> I am new on this list, and new in the progamming world.

Welcome to both of these places!

> I've started to develop an app. (OpenCoffee,
> http://opencoffee.lnxteam.org) using PyQT.
> I am newbie, but i am doing my homework and reading a lot about python
> and pyqt, which i did by now a lot of progress on my app ;);)
>
> My questions:
>
> Is there around an example of how to implement tray system? I just need
> basics: a MainWindow docked in tray system when i press or do "X" action
> (example, pressing exit in actionMenu or closing the mainWindow, etc.).
> I've read the class QSystemTrayIcon but still i have many doubs of how
> to implement it.

A system tray icon is a lot like a widget. Create an instance of it, give
it an icon by creating a QIcon using a QPixmap and calling setIcon(), set
up some signals and slots connections, then show it.

If you are comfortable reading C++, the System Tray example documentation
should give you some hints about using the QSystemTrayIcon class:

  http://doc.trolltech.com/4.3/desktop-systray.html

> My other doub over this week development, if is possible to dock a bash
> console (or like it) inside my PyQt app? I didn't find any examples yet
> or documentation about it.
> I just awnt to dock a bash condole kind inside a QStackedWidget.

You could embed a console application's window in a container widget on
X11 using the QX11EmbedContainer widget:

  http://doc.trolltech.com/4.3/qx11embedcontainer.html

Alternatively, it may be possible to use pyqonsole to do what you want,
as long as all the licenses involved are compatible and you can make it
work with the version of PyQt you are using:

  http://www.logilab.org/project/eid/2571

David



More information about the PyQt mailing list