Back to index

python3.2  3.2.2
Public Member Functions
tkinter.test.test_ttk.test_widgets.CheckbuttonTest Class Reference

List of all members.

Public Member Functions

def test_invoke

Detailed Description

Definition at line 85 of file test_widgets.py.


Member Function Documentation

Definition at line 87 of file test_widgets.py.

00087 
00088     def test_invoke(self):
00089         success = []
00090         def cb_test():
00091             success.append(1)
00092             return "cb test called"
00093 
00094         cbtn = ttk.Checkbutton(command=cb_test)
00095         # the variable automatically created by ttk.Checkbutton is actually
00096         # undefined till we invoke the Checkbutton
00097         self.assertEqual(cbtn.state(), ('alternate', ))
00098         self.assertRaises(tkinter.TclError, cbtn.tk.globalgetvar,
00099             cbtn['variable'])
00100 
00101         res = cbtn.invoke()
00102         self.assertEqual(res, "cb test called")
00103         self.assertEqual(cbtn['onvalue'],
00104             cbtn.tk.globalgetvar(cbtn['variable']))
00105         self.assertTrue(success)
00106 
00107         cbtn['command'] = ''
00108         res = cbtn.invoke()
00109         self.assertEqual(res, '')
00110         self.assertFalse(len(success) > 1)
00111         self.assertEqual(cbtn['offvalue'],
00112             cbtn.tk.globalgetvar(cbtn['variable']))
00113 

Here is the call graph for this function:


The documentation for this class was generated from the following file: