Skip to content

Commit

Permalink
add flushing of stdout to update on key event
Browse files Browse the repository at this point in the history
Doing this as a demo for UC Berkeley Practical Neuroimaging class on
contributing to open source while getting your work done
  • Loading branch information
ivanov committed Mar 22, 2013
1 parent 8ec9555 commit d8430fd
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions examples/event_handling/keypress_demo.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,14 @@
Show how to connect to keypress events
"""
from __future__ import print_function
import sys
import numpy as np
import matplotlib.pyplot as plt


def press(event):
print('press', event.key)
sys.stdout.flush()
if event.key=='x':
visible = xl.get_visible()
xl.set_visible(not visible)
Expand Down

0 comments on commit d8430fd

Please sign in to comment.