[pygtk] Using pyGtk under windows application
Matteo Boscolo
matteo.boscolo at boscolini.eu
Sat Mar 5 15:12:30 WST 2011
Sorry for my english .. may be some code is more explicit.
this is my com class:
#!/usr/bin/env python
#oi:=newObj('OpenClient.Interface')
#oi->showDialog()
# example base.py
import pygtk
pygtk.require('2.0')
import gtk
S_OK =0
E_FAIL=1
class Base:
def __init__(self):
self.window = gtk.Window(gtk.WINDOW_TOPLEVEL)
self.window.show()
def main(self):
gtk.main()
class CustomInterface(object):
_reg_clsid_ = "{F184147B-E26F-419E-8BEE-71B669F39D44}"
_reg_desc_ = "Client interface"
_reg_progid_ = "OpenClient.Interface"
_public_methods_ = [
'setParent',
'showDialog'
]
def __init__(self):
self._application = None
self._interface=Base()
def setParent(self, application):
self._application=application
return S_OK
def showDialog(self):
self._interface.main()
return S_OK
def destrory(self):
gtk.main_quit()
if __name__ == "__main__":
import sys
import win32com.server.register
sys.argv.append('--debug')
win32com.server.register.UseCommandLine(CustomInterface)
from a vbs script I call this class :
dim o
msgbox "test"
set o=createObject("OpenClient.Interface")
msgbox "test1"
o.showDialog()
msgbox "test2"
o.destrory()
when the method showDialog() is executed the execution is inside the
method .. so the test2 msgbox dose not appear
what I need to do is extending may main application with some form using
the gtk ..
so looking at the code the system have to execute the showdialog and go
out and stop at the test2 msgbox.
with qt I do the following
class Base:
def __init__(self):
self._app = QtGui.QApplication(sys.argv)
self.MainForm = QtGui.QWidget()
self.MainForm.resize(250, 150)
self.MainForm.setWindowTitle('Exsample')
def main(self):
self.MainForm.show()
and it works as I wont
Regards,
Matteo
Il 05/03/2011 00:13, Arjan Molenaar ha scritto:
>
> Hi Matteo,
>
> I'm not totally sure if I get your question right, but it seems to me
> you should just create a new top-level window. With
> gtk.Window.set_transient_for() you're able to create a parent-child
> relation for this (utility) window.
>
> Regards,
>
> Arjan
>
> Op 4 mrt. 2011 22:55 schreef "Matteo Boscolo"
> <matteo.boscolo at boscolini.eu <mailto:matteo.boscolo at boscolini.eu>> het
> volgende:
> > Hi All,
> > I'm developing an application inside a cad package written in c++ using
> > a python Com server.
> > in this application I would like to create a windows form with a list
> > view reading data from a database ..
> >
> > I would like to have a no modal window so the user can leave the gtk
> > application open.
> >
> > my problem is that if I use the gtk..mainloop()the code is into the gtk
> > application and I cannot use the cad application..
> >
> > I do some test with python thread ..
> > there is other way to do such a think ?
> >
> > Regards,
> > Matteo
> >
>
> ------------------------------------------------------------------------
> ------------------------------------------------------------------------
>
> Nessun virus nel messaggio.
> Controllato da AVG - www.avg.com <http://www.avg.com>
> Versione: 10.0.1204 / Database dei virus: 1435/3481 - Data di
> rilascio: 04/03/2011
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.daa.com.au/pipermail/pygtk/attachments/20110305/badd2b92/attachment.html>
More information about the pygtk
mailing list