473,385 Members | 1,472 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

wx.Timer in wxPython

I am using wx.Timer to update a clock on a wxPython display. The relevant lines of code look like this:

timer = wx.Timer(self, -1)
self.Bind(wx.EVT_TIMER, self.onTick, timer)
timer.Start(milliseconds=1000, oneShot=False)

where self.onTick(self.event) handles the event every second by printing "TICK".

This works on WindowsXP but not on MacOSX. On MacOSX, onTick() never gets called at all.

What am I doing wrong??
May 29 '07 #1
6 13148
ilikepython
844 Expert 512MB
I am using wx.Timer to update a clock on a wxPython display. The relevant lines of code look like this:

timer = wx.Timer(self, -1)
self.Bind(wx.EVT_TIMER, self.onTick, timer)
timer.Start(milliseconds=1000, oneShot=False)

where self.onTick(self.event) handles the event every second by printing "TICK".

This works on WindowsXP but not on MacOSX. On MacOSX, onTick() never gets called at all.

What am I doing wrong??
This should have been posted in the python forum not the cafe. Make sure to post in the correct forum.
May 29 '07 #2
I am using wx.Timer to update a clock on a wxPython display. The relevant lines of code look like this:
Expand|Select|Wrap|Line Numbers
  1. timer = wx.Timer(self, -1)
  2. self.Bind(wx.EVT_TIMER, self.onTick, timer)
  3. timer.Start(milliseconds=1000, oneShot=False)
  4.  
where self.onTick(self.event) handles the event every second by printing "TICK".

This works on WindowsXP but not on MacOSX. On MacOSX, onTick() never gets called at all.

What am I doing wrong??

-- wxNewbie
May 29 '07 #3
bartonc
6,596 Expert 4TB
This should have been posted in the python forum not the cafe. Make sure to post in the correct forum.
Which explains the double post, so I wont berate the OP for such action. Thank ILP.
May 30 '07 #4
bartonc
6,596 Expert 4TB
I am using wx.Timer to update a clock on a wxPython display. The relevant lines of code look like this:
Expand|Select|Wrap|Line Numbers
  1. timer = wx.Timer(self, -1)
  2. self.Bind(wx.EVT_TIMER, self.onTick, timer)
  3. timer.Start(milliseconds=1000, oneShot=False)
  4.  
where self.onTick(self.event) handles the event every second by printing "TICK".

This works on WindowsXP but not on MacOSX. On MacOSX, onTick() never gets called at all.

What am I doing wrong??

-- wxNewbie
As for you, sbernste, we'll teach you about [ code ] tags as we go along.
Timers are a bit of a mystery. I've never been able to find anyone who could tell by why a 50mS wxTimer should only run 16 times a second on one machine out of 4 that I tried my code on. The wxTimers are completely OS dependant, so I guess the only question that I have for you is "What's your wxPython version on the Mac?".
May 30 '07 #5
As for you, sbernste, we'll teach you about [ code ] tags as we go along.
Timers are a bit of a mystery. I've never been able to find anyone who could tell by why a 50mS wxTimer should only run 16 times a second on one machine out of 4 that I tried my code on. The wxTimers are completely OS dependant, so I guess the only question that I have for you is "What's your wxPython version on the Mac?".
(1) What are code tags?

(2) I am running wxPython version 2.8.4.0 (mac-ansi) under MacOsX darwin.

(3) I have implemented a work-around by running a loop in a separate thread that calls time.sleep(1) and fires off a custom wxPython event. But I'd still rather use wxTimer if at all possible.
May 30 '07 #6
bartonc
6,596 Expert 4TB
(1) What are code tags?
It's all right there, on the right hand side of the page when POSTING or REPLYing: 4 little things to keep in mind in * GUIDELINES...

(2) I am running wxPython version 2.8.4.0 (mac-ansi) under MacOsX darwin.
I just got a Mac (kind of old, but it was free - OS X 10.1.5). I may have to start playing with it soon. I'm on a HUGE project at the moment.

(3) I have implemented a work-around by running a loop in a separate thread that calls time.sleep(1) and fires off a custom wxPython event. But I'd still rather use wxTimer if at all possible.
Nice work-around...
I remember reading that if the system is short on timer resources, the wxTimer objects would not run. Perhaps that's the case here. Or perhaps there's a compatability issue with that OS. It's always worth trying the latest version.

Good luck...
May 30 '07 #7

Sign in to post your reply or Sign up for a free account.

Similar topics

7
by: SeeBelow | last post by:
Do many people think that wxPython should replace Tkinter? Is this likely to happen? I ask because I have just started learning Tkinter, and I wonder if I should abandon it in favor of...
5
by: Laughlin, Joseph V | last post by:
If I want a function to be called every second, how would I do this? Would I use timer events? Joe Laughlin Phantom Works - Integrated Technology Development Labs The Boeing Company
1
by: Qiangning Hong | last post by:
I asked this question on comp.python.wxpython using the subject "a wx.Timer like timer without wx package?" and David Fraser there suggested me to ask here for a more general solution. I am...
1
by: timothy.williams | last post by:
I'm trying to install wxPython 2.5.3.1 using Python 2.3.2 on a Fedora 2 machine. I have python in a non-standard place, but I'm using --prefix with the configure script to point to where I have...
2
by: janama | last post by:
Hi all, Using wx When adding a second timer as i have the first, the second timer adding stops the first timer (updating or stops?) . In this example im updating a uptime and localtime label....
3
by: John Salerno | last post by:
I'd be curious to know if this works any differently on other computers/platforms or while other things are happening in the background. I can't tell if it's the Timer object that isn't keep...
3
by: hg | last post by:
Hi, I read that logging was thread safe ... but can I use it under a GUI timer ? Thanks, hg
4
by: John Dann | last post by:
I need what I'd call (in .Net) a timer, ie I need to run a function eg every 2 seconds - it doesn't need to be millisec accurate but it would be nice if it wasn't eg every 4 seconds or something. ...
3
by: 5lvqbwl02 | last post by:
Windows XP SP3 Python 2.5 wx.version() = '2.8.1.1 (msw-unicode)' ------ I have written the following *simplest* implementation of wx.timer I can think of. No workie. I want an exception, a...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.