Good morning
is it possible to make something like this?
from wx import evt
def funccallbac(param1):
if evt.GetKeyCode() == 13:
return do_something()
return
``
The objective is to be able to call a function but without the need of passing the event as a function argument.
Thanks to your comments and suggestions.
well, no.
if you have an event like that, with a KeyCode, or whatever, that event get
created by the system, and it somehow needs to get to your code.
That is all handles in wx by the mainloop. when you bind event to a
handler, then the mailoop knows to call that handler when that event
occurs, and passes the event to the handler can know the details of what
occured to trigger that event.
You should probably tell us what you are trying to accomplish, because what
you are asking for really doesn't make sense:
when would funccallbac()get called in your example? How would it know there
was an event to work with? The answete is that in event driven programming,
EVERYTHING happens as the result of an event. there is no other way to run
code after the mainloop is started.
-CHB
···
On Thu, Apr 5, 2018 at 8:08 AM, sebastian lópez <selobu@gmail.com> wrote:
where evt is an envent
El jueves, 5 de abril de 2018, 9:23:21 (UTC-5), sebastian lópez escribió:
Good morning
is it possible to make something like this?
from wx import evt
def funccallbac(param1):
if evt.GetKeyCode() == 13:
return do_something()
return
The objective is to be able to call a function but without the need of
passing the event as a function argument.
--
Christopher Barker, Ph.D.
Oceanographer
Emergency Response Division
NOAA/NOS/OR&R (206) 526-6959 voice
7600 Sand Point Way NE (206) 526-6329 fax
Seattle, WA 98115 (206) 526-6317 main reception
Chris.Barker@noaa.gov