>>>>> "Martin" == Martin Richter <[EMAIL PROTECTED]> writes:
Martin> My question now is: Is there a way to avoid using global
Martin> variables but also avoid an object-oriented programming?
Martin> In other words: Is it possible to pass e.g. a dictionary
Martin> containing some information to the function called by the
Martin> event? The reason for not wanting the object-oriented way
Martin> is: We want to teach something to students who never
Martin> programmed before. And to them it would be pretty hard if
Martin> we start everything object-oriented!
The can use attrs on the function
def two_parts(event):
if event.button == 3:
two_parts.program_part = two_parts.program_part%2 + 1
print " Changed to part to ", program_part
if two_parts.program_part == 1 and event.button == 1:
plot([event.xdata], [event.ydata], marker = 'o', mfc = 'r')
if two_parts.program_part == 2 and event.button == 1:
plot([event.xdata], [event.ydata], marker = 's', mfc = 'g')
draw()
two_parts.program_part = 1
which would introduce them to attributes and pave the way to thinking
about OO.
JDH
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users