@@ -45,8 +45,8 @@ def test_use_ttk(self):
4545 ttk .Style (d .root ).lookup ('.' , 'background' ))
4646 # The bindings work with the themed buttons too.
4747 self .require_mapped (d .root )
48- d ._buttons [0 ].focus_force ()
4948 d .root .update ()
49+ d ._buttons [0 ].focus_force ()
5050 d .root .event_generate ('<Return>' )
5151 d .root .update ()
5252 self .assertEqual (d .num , 0 )
@@ -144,8 +144,8 @@ def test_alt_key(self):
144144 # the matching button (cf. tk::AmpWidget in tk::MessageBox).
145145 d = self .create (buttons = ['Yes' , {'text' : 'No' , 'underline' : 0 }])
146146 self .require_mapped (d .root )
147- d ._buttons [0 ].focus_force ()
148147 d .root .update ()
148+ d ._buttons [0 ].focus_force ()
149149 d .root .event_generate ('<Alt-n>' ) # "No" -> underline 0 -> "N"
150150 d .root .update ()
151151 self .assertEqual (d .num , 1 )
@@ -155,8 +155,8 @@ def test_return_invokes_focused_button(self):
155155 # default and the focus was not moved by keyboard traversal.
156156 d = self .create (buttons = ['Yes' , 'No' ]) # default 0
157157 self .require_mapped (d .root )
158- d ._buttons [1 ].focus_force ()
159158 d .root .update ()
159+ d ._buttons [1 ].focus_force ()
160160 d .root .event_generate ('<Return>' )
161161 d .root .update ()
162162 self .assertEqual (d .num , 1 )
@@ -165,8 +165,8 @@ def test_focus_next_then_return(self):
165165 # <Tab> moves the focus to the next button; <Return> invokes it.
166166 d = self .create (buttons = ['Yes' , 'No' ])
167167 self .require_mapped (d .root )
168- d ._buttons [0 ].focus_force ()
169168 d .root .update ()
169+ d ._buttons [0 ].focus_force ()
170170 d ._buttons [0 ].event_generate ('<Tab>' )
171171 d .root .update ()
172172 d .root .event_generate ('<Return>' )
@@ -177,8 +177,8 @@ def test_focus_prev_then_return(self):
177177 # <Shift-Tab> moves the focus to the previous button.
178178 d = self .create (buttons = ['Yes' , 'No' ])
179179 self .require_mapped (d .root )
180- d ._buttons [1 ].focus_force ()
181180 d .root .update ()
181+ d ._buttons [1 ].focus_force ()
182182 d ._buttons [1 ].event_generate ('<Shift-Tab>' )
183183 d .root .update ()
184184 d .root .event_generate ('<Return>' )
@@ -189,8 +189,8 @@ def test_return_activates_default(self):
189189 # <Return> with the focus off the buttons invokes the default button.
190190 d = self .create () # default 0
191191 self .require_mapped (d .root )
192- d .root .focus_force () # the dialog, not a button, has the focus
193192 d .root .update ()
193+ d .root .focus_force () # the dialog, not a button, has the focus
194194 d .root .event_generate ('<Return>' )
195195 d .root .update ()
196196 self .assertEqual (d .num , 0 )
@@ -279,8 +279,8 @@ def test_use_classic(self):
279279 invoked = []
280280 cancel = d .children ['cancel' ]
281281 cancel .configure (command = lambda : invoked .append (True ))
282- cancel .focus_force ()
283282 d .update ()
283+ cancel .focus_force ()
284284 d .event_generate ('<Return>' )
285285 d .update ()
286286 self .assertTrue (invoked )
@@ -359,8 +359,8 @@ def test_alt_key(self):
359359 invoked = []
360360 cancel = d .children ['cancel' ] # "&Cancel"
361361 cancel .configure (command = lambda : invoked .append (True ))
362- d .focus_force ()
363362 d .update ()
363+ d .focus_force ()
364364 d .event_generate ('<Alt-c>' )
365365 d .update ()
366366 self .assertTrue (invoked )
@@ -371,8 +371,8 @@ def test_return_invokes_focused_button(self):
371371 invoked = []
372372 cancel = d .children ['cancel' ]
373373 cancel .configure (command = lambda : invoked .append (True ))
374- cancel .focus_force ()
375374 d .update ()
375+ cancel .focus_force ()
376376 d .event_generate ('<Return>' )
377377 d .update ()
378378 self .assertEqual (invoked , [True ])
@@ -384,8 +384,8 @@ def test_focus_next_then_return(self):
384384 for name in ('ok' , 'cancel' ):
385385 d .children [name ].configure (command = lambda name = name : invoked .append (name ))
386386 ok = d .children ['ok' ]
387- ok .focus_force ()
388387 d .update ()
388+ ok .focus_force ()
389389 ok .event_generate ('<Tab>' ) # OK -> Cancel
390390 d .update ()
391391 d .event_generate ('<Return>' )
@@ -399,8 +399,8 @@ def test_focus_prev_then_return(self):
399399 for name in ('ok' , 'cancel' ):
400400 d .children [name ].configure (command = lambda name = name : invoked .append (name ))
401401 cancel = d .children ['cancel' ]
402- cancel .focus_force ()
403402 d .update ()
403+ cancel .focus_force ()
404404 cancel .event_generate ('<Shift-Tab>' ) # Cancel -> OK
405405 d .update ()
406406 d .event_generate ('<Return>' )
0 commit comments