Popular recipes tagged "mainloop"http://code.activestate.com/recipes/tags/mainloop/2017-06-13T18:54:02-07:00ActiveState Code RecipesUsing Tkinter's Invoke Method for testing (Python)
2017-06-13T18:54:02-07:00Stephen Rigdenhttp://code.activestate.com/recipes/users/4191139/http://code.activestate.com/recipes/578978-using-tkinters-invoke-method-for-testing/
<p style="color: grey">
Python
recipe 578978
by <a href="/recipes/users/4191139/">Stephen Rigden</a>
(<a href="/recipes/tags/invoke/">invoke</a>, <a href="/recipes/tags/mainloop/">mainloop</a>, <a href="/recipes/tags/tkinter/">tkinter</a>, <a href="/recipes/tags/ttk/">ttk</a>, <a href="/recipes/tags/unittest/">unittest</a>, <a href="/recipes/tags/unittests/">unittests</a>).
</p>
<p>This recipe shows a skeleton unittest fixture that calls a widget's command using <code>invoke</code> without starting tkinter's mainloop. (Tcl8.6.3/Tk8.6.3.)</p>
Robust Testing of Tkinter Menu Items with Mocking. (Python)
2017-06-13T18:44:58-07:00Stephen Rigdenhttp://code.activestate.com/recipes/users/4191139/http://code.activestate.com/recipes/578964-robust-testing-of-tkinter-menu-items-with-mocking/
<p style="color: grey">
Python
recipe 578964
by <a href="/recipes/users/4191139/">Stephen Rigden</a>
(<a href="/recipes/tags/invoke/">invoke</a>, <a href="/recipes/tags/mainloop/">mainloop</a>, <a href="/recipes/tags/mock/">mock</a>, <a href="/recipes/tags/mocking/">mocking</a>, <a href="/recipes/tags/tk/">tk</a>, <a href="/recipes/tags/tkinter/">tkinter</a>, <a href="/recipes/tags/unittest/">unittest</a>, <a href="/recipes/tags/unittesting/">unittesting</a>, <a href="/recipes/tags/unittests/">unittests</a>).
Revision 7.
</p>
<p>This recipe addresses the problems encountered when building robust tests for Tk menus.
The software under test is a simple window with two menu items that each invoke a one button dialog box. All user visible text is imported from an external config.ini file.
This scenario can lead to fragile test code because of the way TK's invoke(index) command has been implemented. (Tcl8.6.3/Tk8.6.3.)</p>