Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 19 additions & 24 deletions vpython/vpython.py
Original file line number Diff line number Diff line change
Expand Up @@ -383,15 +383,14 @@ def handle_msg(self, msg):
elif evt['widget'] == 'winput':
obj._text = evt['text']
obj._number = evt['value']

# inspect the bound function and see what it's expecting
if _ispython3: # Python 3
a = signature(obj._bind)
if str(a) != '()': obj._bind( obj )
else: obj._bind()
else: # Python 2
a = getargspec(obj._bind)
if len(a.args) > 0: obj._bind( obj )
else: obj._bind()
a = signature(obj._bind)
if str(a) != '()':
obj._bind( obj )
else:
obj._bind()

else: ## a canvas event
if 'trigger' not in evt:
cvs = baseObj.object_registry[evt['canvas']]
Expand Down Expand Up @@ -3232,14 +3231,12 @@ def handle_event(self, evt): ## events and scene info updates
del evt['height']
for fct in self._binds['resize']:
# inspect the bound function and see what it's expecting
if _ispython3: # Python 3
a = signature(fct)
if str(a) != '()': fct( evt )
else: fct()
else: # Python 2
a = getargspec(fct)
if len(a.args) > 0: fct( evt )
else: fct()
a = signature(fct)
if str(a) != '()':
fct(evt)
else:
fct()

else: # pause/waitfor, update_canvas
if 'pos' in evt:
pos = evt['pos']
Expand All @@ -3259,14 +3256,12 @@ def handle_event(self, evt): ## events and scene info updates
evt1 = event_return(evt) ## turn it into an object
for fct in self._binds[ev]:
# inspect the bound function and see what it's expecting
if _ispython3: # Python 3
a = signature(fct)
if str(a) != '()': fct( evt1 )
else: fct()
else: # Python 2
a = getargspec(fct)
if len(a.args) > 0: fct( evt1 )
else: fct()
a = signature(fct)
if str(a) != '()':
fct( evt1 )
else:
fct()

self._waitfor = evt1 # what pause and waitfor are looking for
else: ## user can change forward (spin), range/autoscale (zoom), up (touch), center (pan)
if 'forward' in evt and self.userspin and not self._set_forward:
Expand Down