<html><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">
<br><div><div>On Dec 14, 2007, at 8:51 AM, Sean McBride wrote:</div><div><br class="webkit-block-placeholder"></div><blockquote type="cite"><blockquote type="cite"> </blockquote><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; min-height: 14px; "><br></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">I'm sorry I can't help more... I've never used Python.<span class="Apple-converted-space"> </span>Which executable</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">runs Python scripts?<span class="Apple-converted-space"> </span>Have you used other Python scripts that display a</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">window and successfully allow interaction?</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; min-height: 14px; "><br></div></blockquote><br></div><div>The executable is 'python' and is generally found in /usr/bin/</div><div>And I have successfully used the module 'Tkinter' (stands for Tk interface). The following script opens a window that opens and closes fine and registers keys and clicks (Obviously it doesn't use vtkRenderWindow)</div><div><br class="webkit-block-placeholder"></div><div>________________</div><div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><font face="Helvetica" size="3" style="font: 12.0px Helvetica"># File: MouseKeyClicks.py</font></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 12px/normal Helvetica; min-height: 14px; "><br></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><div>from Tkinter import *# load Tkinter module</div>root = Tk() # root widget is the window</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><br class="webkit-block-placeholder"></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "># define mouse and key callbacks</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><div>def callback(event):</div><div> frame.focus_set()</div><div> print "clicked mouse"</div><div><br class="webkit-block-placeholder"></div><div>def key(event):</div><div> frame.focus_set()</div><div> print "pressed key"</div><div><br class="webkit-block-placeholder"></div><div># make window</div><div>frame = Frame(root, width=300, height=300)</div><div># bind callbacks to keys and left mouse click</div><div>frame.bind("<Key>",key)</div><div>frame.bind("<Button-1>",callback)</div><div>frame.pack() # size window and make it visible</div><div>frame.focus_set() # set focus to the frame so events will be registered</div></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><br class="webkit-block-placeholder"></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><font face="Helvetica" size="3" style="font: 12.0px Helvetica">root.mainloop() # enter event loop</font></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">________________</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><br class="webkit-block-placeholder"></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-Alethea</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><br class="webkit-block-placeholder"></div></div></body></html>