当前位置: 首页>>代码示例>>Python>>正文


Python Window.window_closed方法代码示例

本文整理汇总了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):
#.........这里部分代码省略.........
开发者ID:Schatzman,项目名称:testipy,代码行数:103,代码来源:test_core.py


注:本文中的GUI.Window.window_closed方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。