Nictk 2.2.0
An easy to use pyton GUI
winfo.py

An example showing all the options for the Nictk.Misc.get_winfo() method (inherited by windows and interior widgets).

1# This file is part of Nictk - A simple tkinter wrapper.
2# Copyright (C) 2021-2024 Nicola Cassetta
3# See <https://github.com/ncassetta/Nictk>
4#
5# This program is free software: you can redistribute it and/or modify
6# it under the terms of the GNU Lesser General Public License as published
7# by the Free Software Foundation, either version 3 of the License, or
8# (at your option) any later version.
9#
10# This program is distributed in the hope that it will be useful,
11# but WITHOUT ANY WARRANTY; without even the implied warranty of
12# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13# GNU Lesser General Public License for more details.
14#
15# You should have received a copy of the Lesser GNU General Public License
16# along with this program. If not, see <https://www.gnu.org/licenses/>.
17
18
19# Allows import from parent folder. You can delete this if you install the package
20import _setup
21
22import Nictk as Ntk
23
24winfo_options = ["atom", "atomname", "cells", "children", "class", "colormapfull", "containing",
25 "depth", "exists", "fpixels", "geometry", "height", "id", "interps", "ismapped",
26 "manager", "name", "parent", "pathname", "pixels", "pointerx", "pointerxy",
27 "pointery", "reqheight", "reqwidth", "rgb", "rootx", "rooty", "screen", "screencells",
28 "screendepth", "screenheight", "screenmmheight", "screenmmwidth", "screenvisual",
29 "screenwidth", "server", "toplevel", "viewable", "visual", "visualid", "visualsavailable",
30 "vrootheight", "vrootwidth", "vrootx", "vrooty", "width", "x", "y"]
31
32winMain = Ntk.Main(100, 100, 800, 600, title="winfo demo")
33labTest = Ntk.Label(winMain, 0, 0, "fill", 50, pad=(30, 10, 30, 10), content="labTest")
34txtTest = Ntk.Text(winMain, 0, "pack", "fill", "fill", pad=(30, 5, 30, 10))
35
36for opt in winfo_options:
37 try:
38 output = labTest.get_winfo(opt)
39 except TypeError:
40 output = "NEEDS PARAM "
41 desc = "{:40}{:>30}".format('labTest.get_winfo("' + opt + '")', str(output))
42 txtTest.append_text(desc + "\n")
43
44Ntk.mainloop()