# Based on iwidgets2.2.0/tests/dialog.test code.
if Tkinter
.TkVersion
>= 8.3:
version
= sys
.version_info
if version
[0] > 2 or (version
[0] == 2 and version
[1] > 0):
expected1
= "AttributeError: Dialog instance has no attribute 'bogus'"
expected1
= "AttributeError: 'Dialog' instance has no attribute 'bogus'"
expected1
= 'AttributeError: bogus'
_lb
= Tkinter
.Listbox(w
.interior(), relief
= 'sunken')
_lb
.pack(fill
= 'both', expand
= 'yes')
def _test_deactivate(result
):
w
.after(Test
.delay() + 4000,
lambda widget
=w
, r
=result
: widget
.deactivate(r
))
def _createOtherToplevel():
Test
.root
.geometry('+0+0')
tempToplevel
= Tkinter
.Toplevel()
tempToplevel
.geometry('+0+0')
label
= Tkinter
.Label(tempToplevel
, text
=
'The cursor should turn to a\n' +
'clock over this window if the\n' +
'blt busy command is available.\n' +
'In any case, the button will be inactive\n' +
'while the modal dialog is active.')
label
.pack(padx
=100, pady
=100)
button
= Tkinter
.Button(tempToplevel
, text
= 'Try to press me')
button
.pack(pady
=100, expand
=1)
def _hideOtherToplevel():
('buttons', ('OK', 'Cancel',)),
(Test
.num_options
, (), 9),
('hull_background', '#d9d9d9'),
('buttons', ('A', 'B', 'C', 'D')),
('hull_cursor', 'gumby'),
(c
.title
, 'Dialog Shell', ''),
(c
.interior
, (), Tkinter
.Frame
),
('buttons', ('OK', 'Cancel')),
('buttons', ('OK', 'Cancel', 'Help')),
('buttons', ('Apply', 'OK', 'Cancel', 'Help')),
('buttons', ('Apply', 'OK', 'Cancel')),
('defaultbutton', 'Cancel'),
(c
.invoke
, 'OK', 'None'),
('buttonbox_OK_text', 'OOOOOKKKKK'),
('buttons', ('Apply', 'OK', 'Cancel', 'Foo')),
('buttons', ('Apply', 'OK', 'Cancel')),
(_createOtherToplevel
, ()),
(_addListEntry
, 'Testing application activate/deactivate'),
(_addListEntry
, 'Please wait'),
(_test_deactivate
, 'Hello World'),
(c
.activate
, (), 'Hello World'),
(_addListEntry
, 'Now testing global activate/deactivate'),
(_addListEntry
, 'Please wait a bit more'),
(_test_deactivate
, 'Hello World'),
(c
.activate
, (1), 'Hello World'),
(_hideOtherToplevel
, ()),
('buttons', ('Apply', 'OK', 'Cancel', 'Foo', '1')),
kw_2
= {'buttonboxpos' : 'e', 'separatorwidth' : 5}
('buttons', ('OK', 'Cancel',)),
testData
= ((c
, alltests
),)
if __name__
== '__main__':