[PyKDE] PyQT and QPE/Zaurus coding tips
Trevor Phillips
T.Phillips at murdoch.edu.au
Fri Oct 17 03:06:01 BST 2003
On Friday 17 October 2003 02:19, Paul Evans wrote:
> On October 16, 2003 05:39 am, Trevor Phillips wrote:
> > Firstly, how can I associate an icon with my Widget/App, such that the
> > icon will appear in the Qtopia/Opie task-bar?
>
> from qtpe import QPEApplication
> then use QPEApplication throughout instead of QApplication
Hmmm. I saw that on the dev board as well. I'm already doing that, but still
no luck. I also tried their suggestion to use QPEApplication(sys.argv[1:]) -
again, no luck.
I'm writing the app such that it'll work with or without qtpe. Here's the
rough framework I'm using. Any hints/tips would be good; I hadn't touched
Python or Qt at all before this week. ^_^
from qt import *
try:
from qtpe import QPEApplication
onzaurus = 1
except ImportError:
onzaurus = 0
# Dialog to hold our Widget app if not qtpe...
class MainDlg(QDialog):
def __init__(self,parent = None,name = None,modal = 0,fl = 0):
QDialog.__init__(self,parent,name,modal,fl)
if not name:
self.setName("MainDlg")
self.mainLayout = QVBoxLayout(self,0,0,"MainDlgLayout")
if __name__ == '__main__':
if onzaurus:
app = QPEApplication(sys.argv[1:])
win = MainWid() # The main application widget
apwid = win
app.showMainWidget(win)
else:
app = QApplication(sys.argv)
win = MainDlg()
apwid = MainWid(parent=win)
win.mainLayout.addWidget(apwid)
apwid.show()
app.setMainWidget(win)
win.show()
QObject.connect(app, SIGNAL('lastWindowClosed()'), app, SLOT('quit()'))
# Gui Loop
app.exec_loop()
--
. Trevor Phillips - http://jurai.murdoch.edu.au/ .
: Web Technical Administrator - T.Phillips at murdoch.edu.au :
| IT Services - Murdoch University |
>--------------------------------------------------------------------<
| On nights such as this, evil deeds are done. And good deeds, of /
| course. But mostly evil, on the whole. /
\ -- (Terry Pratchett, Wyrd Sisters) /
More information about the PyQt
mailing list