How to use the ttkwidgets.SnapToplevel function in ttkwidgets

To help you get started, we’ve selected a few ttkwidgets examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github TkinterEP / ttkwidgets / tests / test_snaptoplevel.py View on Github external
def test_snaptoplevel_init(self):
        snap = SnapToplevel(self.window)
github TkinterEP / ttkwidgets / tests / test_snaptoplevel.py View on Github external
def test_snaptoplevel_kwargs(self):
        snap = SnapToplevel(self.window, border=50, anchor=tk.LEFT, offset_sides=10, offset_top=30, allow_change=True,
                            resizable=True)

        def configure_function(event):
            assert isinstance(event.widget, tk.Toplevel) or isinstance(event.widget, tk.Tk)

        snap = SnapToplevel(self.window, configure_function=configure_function)
        self.window.update()

        snap.configure(border=50)
        snap.config(border=50, anchor=tk.LEFT, offset_sides=10, offset_top=30, allow_change=True, resizable=True,
                    configure_function=None, locked=False, width=300)

        self.assertEqual(snap.cget("border"), 50)
        self.assertEqual(snap.cget("anchor"), tk.LEFT)
        self.assertEqual(snap.cget("offset_sides"), 10)
        self.assertEqual(snap.cget("offset_top"), 30)
github TkinterEP / ttkwidgets / tests / test_snaptoplevel.py View on Github external
        self.assertRaises(ValueError, lambda: SnapToplevel(tk.Label()))
        self.assertRaises(ValueError, lambda: SnapToplevel(self.window, anchor=tk.W))
github TkinterEP / ttkwidgets / tests / test_snaptoplevel.py View on Github external
        self.assertRaises(ValueError, lambda: SnapToplevel(self.window, offset_sides="5"))
        self.assertRaises(ValueError, lambda: SnapToplevel(self.window, offset_top="5"))
github TkinterEP / ttkwidgets / tests / test_snaptoplevel.py View on Github external
        self.assertRaises(ValueError, lambda: SnapToplevel(self.window, border="50"))
        self.assertRaises(ValueError, lambda: SnapToplevel(self.window, offset_sides="5"))
github TkinterEP / ttkwidgets / tests / test_snaptoplevel.py View on Github external
def test_snaptoplevel_get_distance_to_master(self):
        results = SnapToplevel(self.window).get_distance_to_master()
        self.assertIsInstance(results, dict)
        self.assertEqual(len(results), 4)
        self.assertTrue(tk.RIGHT in results)
        self.assertTrue(tk.LEFT in results)
        self.assertTrue(tk.TOP in results)
        self.assertTrue(tk.BOTTOM in results)
        for value in results.values():
            self.assertIsInstance(value, int)
            self.assertGreaterEqual(value, 0)
github TkinterEP / ttkwidgets / tests / test_snaptoplevel.py View on Github external
def test_snaptoplevel_set_geometry_master(self):
        for anchor in (tk.RIGHT, tk.LEFT, tk.TOP, tk.BOTTOM):
            window = tk.Toplevel()
            snap = SnapToplevel(window, anchor=anchor)
            snap.set_geometry_master()
github TkinterEP / ttkwidgets / tests / test_snaptoplevel.py View on Github external
def test_snaptoplevel_changestate_callbacks(self):
        snap = SnapToplevel(self.window)
        self.window.update()
        snap.minimize(None)
        self.window.update()
        snap.deminimize(None)
        self.window.update()
github TkinterEP / ttkwidgets / tests / test_snaptoplevel.py View on Github external
        self.assertRaises(ValueError, lambda: SnapToplevel(self.window, resizable="False"))