For my drawing application, I figured it would be logical to display the
x/y coordinates of the mouse in the status bar, to coincide with my new
version that allows you to reposition and resize previously drawn shapes.
So, a simple test on my father's computer, fairly old - Athlon XP
1.65GHz, 512MB RAM, windows XP SP2 shows that adding the status updates
takes the CPU usage to 50% just moving the mouse around the program.
Commenting the code out dropped usage to almost nothing.
As an experiment, I fired up Paint and looked at the CPU usage there -
between 8-10% (it also displays x/y coords in the status bar)
On my computer, an Athlon X2-3800, 2.5GHz, 2GB RAM, using Ubuntu 9.04 I
see CPU usage at around 10% using "top -d 1" to get constant updates.
Commenting the code and python doesn't even appear in top. I've yet to
look at the numbers on my XP box but I imagine they're fairly low.
Is this just too much of a performance heavy thing to implement?
For my drawing application, I figured it would be logical to display the
x/y coordinates of the mouse in the status bar, to coincide with my new
version that allows you to reposition and resize previously drawn shapes.
So, a simple test on my father's computer, fairly old - Athlon XP
1.65GHz, 512MB RAM, windows XP SP2 shows that adding the status updates
takes the CPU usage to 50% just moving the mouse around the program.
Commenting the code out dropped usage to almost nothing.
As an experiment, I fired up Paint and looked at the CPU usage there -
between 8-10% (it also displays x/y coords in the status bar)
On my computer, an Athlon X2-3800, 2.5GHz, 2GB RAM, using Ubuntu 9.04 I
see CPU usage at around 10% using "top -d 1" to get constant updates.
Commenting the code and python doesn't even appear in top. I've yet to
look at the numbers on my XP box but I imagine they're fairly low.
Is this just too much of a performance heavy thing to implement?
For my drawing application, I figured it would be logical to display the
x/y coordinates of the mouse in the status bar, to coincide with my new
version that allows you to reposition and resize previously drawn shapes.
So, a simple test on my father's computer, fairly old - Athlon XP
1.65GHz, 512MB RAM, windows XP SP2 shows that adding the status updates
takes the CPU usage to 50% just moving the mouse around the program.
Commenting the code out dropped usage to almost nothing.
As an experiment, I fired up Paint and looked at the CPU usage there -
between 8-10% (it also displays x/y coords in the status bar)
On my computer, an Athlon X2-3800, 2.5GHz, 2GB RAM, using Ubuntu 9.04 I
see CPU usage at around 10% using "top -d 1" to get constant updates.
Commenting the code and python doesn't even appear in top. I've yet to
look at the numbers on my XP box but I imagine they're fairly low.
Is this just too much of a performance heavy thing to implement?
How are you doing it?
Whoops, my bad. My ScrolledPanel, not the entire frame has the follow
left mouse down event bound:
def left_motion(self, event):
"""Updates the shape. Indicate shape may be changed using Select
tool"""
x, y = self.convert_coords(event)
self.gui.SetStatusText(" %s, %s" % (x, y))
# these return false, not being called during the mouse motion
if self.drawing and not isinstance(self.shape, Text):
self.shape.motion(x, y)
self.draw_shape(self.shape)
elif isinstance(self.shape, Select):
for shape in reversed(self.shapes):
if shape.handle_hit_test(x, y):
self.SetCursor(wx.StockCursor(wx.CURSOR_SIZING))
break
if shape.hit_test(x, y):
self.SetCursor(wx.StockCursor(wx.CURSOR_HAND))
break
else:
self.change_cursor()
For my drawing application, I figured it would be logical to display the
x/y coordinates of the mouse in the status bar, to coincide with my new
version that allows you to reposition and resize previously drawn shapes.
So, a simple test on my father's computer, fairly old - Athlon XP
1.65GHz, 512MB RAM, windows XP SP2 shows that adding the status updates
takes the CPU usage to 50% just moving the mouse around the program.
Commenting the code out dropped usage to almost nothing.
As an experiment, I fired up Paint and looked at the CPU usage there -
between 8-10% (it also displays x/y coords in the status bar)
On my computer, an Athlon X2-3800, 2.5GHz, 2GB RAM, using Ubuntu 9.04 I
see CPU usage at around 10% using "top -d 1" to get constant updates.
Commenting the code and python doesn't even appear in top. I've yet to
look at the numbers on my XP box but I imagine they're fairly low.
Is this just too much of a performance heavy thing to implement?
def left_motion(self, event):
"""Updates the shape. Indicate shape may be changed using Select
tool"""
x, y = self.convert_coords(event)
self.gui.SetStatusText(" %s, %s" % (x, y))
# [[more code, that is not called/matters in this issue (deals
with mouse button pressed)
A quick (though minor) optimization would be to skip this code if the event.Position is the same as the last time you set the status text. (It's possible to get more than one event for the same position depending how you've bound the event handler.)
Another optimization would be to not call SetStatusText from the motion event, but just save the position and then call SetStatusText (only if it has changed) from an idle or timer handler.
···
On 10/4/09 6:00 PM, Steven Sproat wrote:
Robin Dunn wrote:
On 10/4/09 4:49 PM, Steven Sproat wrote:
For my drawing application, I figured it would be logical to display the
x/y coordinates of the mouse in the status bar, to coincide with my new
version that allows you to reposition and resize previously drawn shapes.
So, a simple test on my father's computer, fairly old - Athlon XP
1.65GHz, 512MB RAM, windows XP SP2 shows that adding the status updates
takes the CPU usage to 50% just moving the mouse around the program.
Commenting the code out dropped usage to almost nothing.
As an experiment, I fired up Paint and looked at the CPU usage there -
between 8-10% (it also displays x/y coords in the status bar)
On my computer, an Athlon X2-3800, 2.5GHz, 2GB RAM, using Ubuntu 9.04 I
see CPU usage at around 10% using "top -d 1" to get constant updates.
Commenting the code and python doesn't even appear in top. I've yet to
look at the numbers on my XP box but I imagine they're fairly low.
Is this just too much of a performance heavy thing to implement?
How are you doing it?
Whoops, my bad. My ScrolledPanel, not the entire frame has the follow
left mouse down event bound:
def left_motion(self, event):
"""Updates the shape. Indicate shape may be changed using Select
tool"""
x, y = self.convert_coords(event)
self.gui.SetStatusText(" %s, %s" % (x, y))