(The code for it has evolved a bit since then, but it's still the same
principle.)
Now I have a problem with it. When I do
`self.Bind(thread_timer.EVT_THREAD_TIMER, some_method)`, I want to be
able to use the id/source parameters of the `Bind` method. I want to
be able to differentiate between different ThreadTimer events.
What would be a good way to this?
I've tried sticking some random number like this: `event =
wx.PyEvent(1138)`, and this works and would let me differentiate as I
wish, but I don't want to conflict with wxPython's id scheme.
For some reason I am pretty sure I remember that being somebody else's idea...
(The code for it has evolved a bit since then, but it's still the same
principle.)
Now I have a problem with it. When I do
`self.Bind(thread_timer.EVT_THREAD_TIMER, some_method)`, I want to be
able to use the id/source parameters of the `Bind` method. I want to
be able to differentiate between different ThreadTimer events.
What would be a good way to this?
I've tried sticking some random number like this: `event =
wx.PyEvent(1138)`, and this works and would let me differentiate as I
wish, but I don't want to conflict with wxPython's id scheme.
Just do it like any other widget does. Give the thread an ID when you create it.
ID_THREAD1 = wx.NewId()
ThreadTimer(parent, id)
Then just store the ID and use it when the thread fires its events.
For some reason I am pretty sure I remember that being somebody else’s idea…
That’s right, ThreadTimer was your idea that you suggested and it solved my problem. You wrote the original code and I developed it further. Thus it can be said we have both developed ThreadTimer. I was not trying to claim I invented it.
(The code for it has evolved a bit since then, but it’s still the same
principle.)
Now I have a problem with it. When I do
self.Bind(thread_timer.EVT_THREAD_TIMER, some_method), I want to be
able to use the id/source parameters of the Bind method. I want to
be able to differentiate between different ThreadTimer events.
What would be a good way to this?
I’ve tried sticking some random number like this: `event =
wx.PyEvent(1138)`, and this works and would let me differentiate as I
wish, but I don’t want to conflict with wxPython’s id scheme.
Just do it like any other widget does. Give the thread an ID when you create it.
ID_THREAD1 = wx.NewId()
ThreadTimer(parent, id)
Then just store the ID and use it when the thread fires its events.
Sounds great, this is exactly what I was hoping wxPython will provide me. I’ll use it.