本文整理汇总了Python中GUI.Window.window_closed方法的典型用法代码示例。如果您正苦于以下问题:Python Window.window_closed方法的具体用法?Python Window.window_closed怎么用?Python Window.window_closed使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GUI.Window
的用法示例。
在下文中一共展示了Window.window_closed方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: TestipyGUITests
# 需要导入模块: from GUI import Window [as 别名]
# 或者: from GUI.Window import window_closed [as 别名]
class TestipyGUITests(unittest.TestCase):
"""
Tests relating to graphical user interface functionality.
"""
def setUp(self):
self.main = Window()
# self.main.auto_configure()
self.gui = AppGUI(self.main, True)
def tearDown(self):
try:
self.main.WIN.destroy()
except:
pass # sometimes it has already been destroyed.
def test_WIN(self):
item_on_test = self.main.WIN
if '<tkinter.Tk object at' in repr(item_on_test):
pass
else:
raise Exception(
'Something went wrong, is this a tkinter.Tk object?: ' +
repr(item_on_test)
)
def test_window_closed(self):
self.main.window_closed()
err = ''
try:
self.main.WIN.winfo_exists()
except Exception as e:
err = e.__str__()
expected = (
'application has been destroyed'
)
err_lst = []
self.assertTrue(expected in err)
def test_window_show(self):
self.main.WIN.withdraw()
self.assertEqual(self.main.WIN.state(), 'withdrawn')
self.main.window_show()
self.assertEqual(self.main.WIN.state(), 'normal')
def test_configure(self):
print("PRE CONFIGURE")
print(self.main.WIN.winfo_width())
print(self.main.WIN.winfo_height())
print(self.main.WIN.title())
print(self.main.WIN.wm_protocol()) # 'WM_DELETE_WINDOW'
print(self.main.WIN.wm_resizable()) # (1,1) = resize x True, resize y True
print(self.main.WIN.wm_geometry())
print(self.main.WIN.wm_state())
prtcl_name = "WM_DELETE_WINDOW"
resize = True
func = callback
title = "TESTY McTesterWindow"
x = 1000
y = 1000
self.main.configure(
prtcl_name,
resize,
func,
title,
x, y
)
print("POST CONFIGURE")
print(self.main.WIN.winfo_width())
print(self.main.WIN.winfo_height())
print(self.main.WIN.title())
print(self.main.WIN.wm_protocol()) # 'WM_DELETE_WINDOW'
print(self.main.WIN.wm_resizable())
print(self.main.WIN.wm_geometry())
print(self.main.WIN.wm_state())
# check resizable
# check protocol
# check wm_title
# configure
# check that new values are set.
# import time; time.sleep(5)
# self.assertEqual(self.main.WIN.winfo_width(), 1000)
import pdb; pdb.set_trace()
def test_autoconfigure(self):
# test pulling conf values from yaml.\
fixme
def test_GUI(self):
item_on_test = self.gui
if '<GUI.AppGUI object at' in repr(item_on_test):
pass
else:
raise Exception(
'Something went wrong, is this a GUI.AppGUI object?: ' +
repr(item_on_test)
)
def test_main(self):
#.........这里部分代码省略.........