https://github.com/xinetzone/tkinterx
Use tkinter to create a handy GUI tool.
https://github.com/xinetzone/tkinterx
Last synced: 10 months ago
JSON representation
Use tkinter to create a handy GUI tool.
- Host: GitHub
- URL: https://github.com/xinetzone/tkinterx
- Owner: xinetzone
- License: mpl-2.0
- Created: 2020-05-01T16:52:46.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2022-03-10T03:59:25.000Z (over 4 years ago)
- Last Synced: 2025-03-22T06:37:53.802Z (about 1 year ago)
- Language: Python
- Homepage: https://pypi.org/project/tkinterx
- Size: 251 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# tkinterx
[](https://github.com/xinetzone/pychaos/issues) [](https://github.com/xinetzone/pychaos/network) [](https://github.com/xinetzone/pychaos/stargazers) [](https://github.com/xinetzone/pychaos/blob/master/LICENSE) [](http://hits.dwyl.io/xinetzone/pychaos)   [](https://github.com/xinetzone/pychaos/graphs/contributors) [](https://github.com/xinetzone/pychaos/watchers)
Use tkinter to create a handy GUI tool.
## PyPI support available
You can install the latest version using the following command:
```sh
pip install tkinterx
```
The following command is used when called:
```python
import tkinterx
```
## A sample: Record your personal information
```python
class Window(WindowMeta):
def __init__(self, master=None, cnf={}, **kw):
super().__init__(master, cnf, **kw)
def create_widget(self):
self.add_row('Please enter your name:', 'name')
self.add_row('Please enter your age:', 'age')
self.add_row('Enter your information saving path:', 'save_path')
def save(self, path):
table = self.table.todict()
with open(path, 'w') as fp:
json.dump(table, fp)
def run(self):
self.withdraw()
name = self.table['name']
age = self.table['age']
save_path = str(self.table['save_path'])
if '' in [name, age, save_path]:
showwarning(self)
else:
self.save(save_path)
askokcancel(self)
class Root(Tk):
def __init__(self):
super().__init__()
self.label_var = StringVar()
self.create_widgets()
self.layout()
def create_buttons(self):
style = ttk.Style()
style.configure("C.TButton",
foreground="green",
background="white",
relief='raise',
justify='center',
font=('YaHei', '10', 'bold'))
self.table_button = ttk.Button(self, text='Fill in your name and age:',
command=self.ask_table,
style="C.TButton")
def create_widgets(self):
self.create_buttons()
self.label = ttk.Label(self, textvariable=self.label_var)
def ask_table(self):
bunch = ask_window(self, Window)
name, age = bunch['name'], bunch['age']
self.label_var.set(f"{name}: {age}")
def layout(self):
self.table_button.pack()
self.label.pack()
if __name__ == "__main__":
root = Root()
root.geometry('300x200')
root.mainloop()
```
Interface presentation:

For more information: [Chinese Manual](https://www.jianshu.com/nb/45403586).