Hi All,
This might be a polemic question: Is it possible to have wxPython running
_together_ with (python's) Tcl/Tk Tkinter in the same program - maybe in
different thread ?
First the incentive of wanting that:
聽聽We have a rather big program using Tkinter, and I want to add my stuff or
use it from my other programs. - and obviously I prefer wxPython
On Windows it actually works straight forward: I started PyCrust imported
'Tkinter' and 'thread' - and then I used
thread.start_new() to start e.g. PyShell.main() (after 'import PyShell')
and there I had Tkinter's IDLE running .
But trying the same on Linux, X-Windows (wxGTK), I get:
Xlib: unexpected async reply( sequence 0x835e)!
- and then everything just hangs...
So I guess on X-windows any GUI call needs to come from the same thread
...!?
That means I would have to handle wxPython event from inside the Tkinter
Mainloop or vice versa -
I think doing it the other way around is easier because wxPython allows
doing the Mainloop manually quite nicely.
I was thinking of using Tkinter's Tk_doOneEvent call - but that blocks if no
events are waiting. (Does anyone know a call who would tell me _If_ there is
an event waiting - maybe I could block-until-TK-event-ready and then do a
wxMutexGuiEnter(); )
Any comments ? ( I consider this a very interesting if not important
question since there are so many neat programs written with Tkinter and this
would be an easy way to allow a step-by-step progression towards wxPython
!!)
Hi All,
I did realize that my question might have better chance to get answered by
Tkinter-people ...
Here is some code that now works on Linux:
<pythoncode>
import Tkinter
def mytktimerhandler(ev):
tki = Tkinter.tkinter
while tki.dooneevent(tki.DONT_WAIT):
pass
from wxPython import wx
myapp = wx.wxGetApp()
myframe = myapp.GetTopWindow()
mytktimerevtid = wx.wxNewId()
wx.EVT_TIMER(myframe, mytktimerevtid, mytktimerhandler)
root = Tkinter.Tk()
mytktimer = wx.wxTimer(myframe, mytktimerevtid)
mytktimer.Start(10)
</pythoncode>
On Windows 2000 it works also when I set the timer interval to 50ms !!
I hope someone likes my idea of being able to combine Tkinter and wxPython
(if you don't have an alternative!!)
BTW: The "block-until-TK-event-ready" I was looking for originally is
Tcl_WaitForEvent - but it seems not accessible to Tkinter. Otherwise that
would probably still be better not to use a timer to handle all events.
Cheers,
Sebastian Haase
路路路
----- Original Message -----
From: "Sebastian Haase" <haase@msg.ucsf.edu>
To: <wxPython-users@lists.wxwindows.org>
Sent: Monday, June 09, 2003 11:27 AM
Subject: [wxPython-users] wxPython together with Tkinter
Hi All,
This might be a polemic question: Is it possible to have wxPython running
_together_ with (python's) Tcl/Tk Tkinter in the same program - maybe in
different thread ?
First the incentive of wanting that:
We have a rather big program using Tkinter, and I want to add my stuff
or
use it from my other programs. - and obviously I prefer wxPython
On Windows it actually works straight forward: I started PyCrust imported
'Tkinter' and 'thread' - and then I used
thread.start_new() to start e.g. PyShell.main() (after 'import PyShell')
and there I had Tkinter's IDLE running .
But trying the same on Linux, X-Windows (wxGTK), I get:
Xlib: unexpected async reply( sequence 0x835e)!
- and then everything just hangs...
So I guess on X-windows any GUI call needs to come from the same thread
...!?
That means I would have to handle wxPython event from inside the Tkinter
Mainloop or vice versa -
I think doing it the other way around is easier because wxPython allows
doing the Mainloop manually quite nicely.
I was thinking of using Tkinter's Tk_doOneEvent call - but that blocks if
no
events are waiting. (Does anyone know a call who would tell me _If_ there
is
an event waiting - maybe I could block-until-TK-event-ready and then do a
wxMutexGuiEnter(); )
Any comments ? ( I consider this a very interesting if not important
question since there are so many neat programs written with Tkinter and
this
would be an easy way to allow a step-by-step progression towards wxPython
!!)
Thanks,
Sebastian Haase
---------------------------------------------------------------------
To unsubscribe, e-mail: wxPython-users-unsubscribe@lists.wxwindows.org
For additional commands, e-mail: wxPython-users-help@lists.wxwindows.org
Hi All,
I did realize that my question might have better chance to get answered by
Tkinter-people ...
Here is some code that now works on Linux:
<pythoncode>
import Tkinter
def mytktimerhandler(ev):
tki = Tkinter.tkinter
while tki.dooneevent(tki.DONT_WAIT):
pass
from wxPython import wx
myapp = wx.wxGetApp()
myframe = myapp.GetTopWindow()
mytktimerevtid = wx.wxNewId()
wx.EVT_TIMER(myframe, mytktimerevtid, mytktimerhandler)
root = Tkinter.Tk()
mytktimer = wx.wxTimer(myframe, mytktimerevtid)
mytktimer.Start(10)
</pythoncode>
On Windows 2000 it works also when I set the timer interval to 50ms !!
I hope someone likes my idea of being able to combine Tkinter and wxPython
(if you don't have an alternative!!)
How does the CPU utilization when the app is idle compare?
路路路
--
Robin Dunn
Software Craftsman http://wxPython.org Java give you jitters? Relax with wxPython!
Sebastian Haase wrote:
> Hi All,
> I did realize that my question might have better chance to get answered
by
> Tkinter-people ...
> Here is some code that now works on Linux:
> <pythoncode>
> import Tkinter
> def mytktimerhandler(ev):
> tki = Tkinter.tkinter
> while tki.dooneevent(tki.DONT_WAIT):
> pass
>
> from wxPython import wx
> myapp = wx.wxGetApp()
> myframe = myapp.GetTopWindow()
> mytktimerevtid = wx.wxNewId()
> wx.EVT_TIMER(myframe, mytktimerevtid, mytktimerhandler)
> root = Tkinter.Tk()
> mytktimer = wx.wxTimer(myframe, mytktimerevtid)
> mytktimer.Start(10)
> </pythoncode>
> On Windows 2000 it works also when I set the timer interval to 50ms !!
>
> I hope someone likes my idea of being able to combine Tkinter and
wxPython
> (if you don't have an alternative!!)
How does the CPU utilization when the app is idle compare?
On Windows2000 system (600MHz,P3, lot's of programs open):
the CPU-loads are:
before start of PyCrust: 2-3 %
after just start of PyCrust: 8 %
after executing the code above( 50ms interval): approx..16 % (maybe 12%)
Hi all,
here again the problem of writing lines to files. it is still a strange
problem to me. at home i work with python 2.2 under windows and it seems to
work, but here at the university i work with python 2.0 under windows and it
does not work anymore.
I attached the python file with the mail, so one can look at it... the
problem is in the 2nd panel, only the radiobox saves the information to the
inputfile, the second one:classes, is printed on screen but not written to
the file. the others are not even printed on screen nor written to a file.
While in panel 3 the matlab file is written properly. What am i doing wrong?
i am confused!
I just found out that the EVT_TEXT_ENTER does not work under Python 20
atleast not with my program, are there any solutions to let it work under
Python 20?
Hi all,
here again the problem of writing lines to files. it is still a strange
problem to me. at home i work with python 2.2 under windows and it seems to
work, but here at the university i work with python 2.0 under windows and it
does not work anymore.
I attached the python file with the mail, so one can look at it... the
problem is in the 2nd panel, only the radiobox saves the information to the
inputfile, the second one:classes, is printed on screen but not written to
the file. the others are not even printed on screen nor written to a file.
While in panel 3 the matlab file is written properly. What am i doing wrong?
i am confused!
I just found out that the EVT_TEXT_ENTER does not work under Python 20
atleast not with my program, are there any solutions to let it work under
Python 20?
Please define what you mean by "does not work". Is there an error message or traceback? What is it? When does it happen, when the EVT_* function is called or in the handler? Is there no error but the handler is not called?
Also, what version of wxPython is being used? I haven't done a build for Python 2.0 for a very long time so I expect that it is a very old version. Probably the best thing to do is to use the same version of Python and wxPython in both places.
路路路
--
Robin Dunn
Software Craftsman http://wxPython.org Java give you jitters? Relax with wxPython!
with does not work i mean there happens nothing..nothing is printed on
screen and nothing is written to the file.
i use wxpython version 2.4.0.7 and python2.2
and python2.0 and the wxpython for python 2.0
Stephan
路路路
----- Original Message -----
From: "Robin Dunn" <robin@alldunn.com>
To: <wxPython-users@lists.wxwindows.org>
Sent: Thursday, June 19, 2003 6:25 PM
Subject: Re: [wxPython-users] write to file
stephan huijgen wrote:
> I just found out that the EVT_TEXT_ENTER does not work under Python 20
> atleast not with my program, are there any solutions to let it work
under
> Python 20?
Please define what you mean by "does not work". Is there an error
message or traceback? What is it? When does it happen, when the EVT_*
function is called or in the handler? Is there no error but the handler
is not called?
Also, what version of wxPython is being used? I haven't done a build
for Python 2.0 for a very long time so I expect that it is a very old
version. Probably the best thing to do is to use the same version of
Python and wxPython in both places.
--
Robin Dunn
Software Craftsman http://wxPython.org Java give you jitters? Relax with wxPython!
---------------------------------------------------------------------
To unsubscribe, e-mail: wxPython-users-unsubscribe@lists.wxwindows.org
For additional commands, e-mail: wxPython-users-help@lists.wxwindows.org
The best way to illustrate/document your problem is to make a very short
code sample (no more than a few lines) with which others can reproduce the
behaviour that you're seeing. I find what works quite well is to modify one
of the demo samples until they manifest the "broken" behaviour.
Often, during this reduction, one even manages to find the cause of the
problem!
路路路
On Thu, Jun 19, 2003 at 07:10:12PM +0200, Stephan Huijgen wrote:
with does not work i mean there happens nothing..nothing is printed on
screen and nothing is written to the file.
i use wxpython version 2.4.0.7 and python2.2
and python2.0 and the wxpython for python 2.0
with does not work i mean there happens nothing..nothing is printed on
screen and nothing is written to the file.
i use wxpython version 2.4.0.7 and python2.2
and python2.0 and the wxpython for python 2.0
That still doesn't tell me what version of wxPython you are using on the platform with the problems. Anyway, as Charl said, you need to reduce it to a small as possible standalone sample that has the problem, then it will be much easier for one of us to find the problem, if you don't find the problem youself along the way.
路路路
--
Robin Dunn
Software Craftsman http://wxPython.org Java give you jitters? Relax with wxPython!