|
1 |
| -# python-gttk: Gtk Themeing for Tkinter/ttk |
2 |
| - |
| 1 | +# GTK Theme for Python's tkinter/ttk |
| 2 | + |
| 3 | + |
| 4 | +Would you like to have a more native look for your Tkinter application? |
| 5 | +Are the themes provided in [ttkthemes](https://github.com/TkinterEP/ttkthemes) |
| 6 | +not to your liking? |
| 7 | + |
| 8 | +This package provides a version of [`gtkTtk`](https://github.com/Geballin/gtkTtk), |
| 9 | +formerly [`tilegtk`](https://github.com/xiaq/tile-gtk) packaged for |
| 10 | +usage with Python. Simply follow the installation instructions and all |
| 11 | +required files are installed to the site package directory. |
| 12 | + |
| 13 | +## Installation |
| 14 | +These instructions are for Ubuntu, Python 3.5 or higher. Any lower |
| 15 | +version may work, but is not supported. On other distributions, package |
| 16 | +names may be different. |
| 17 | +```bash |
| 18 | +# Build Tools |
| 19 | +sudo apt install build-essential cmake |
| 20 | +# Required Libraries |
| 21 | +sudo apt install libgtk2.0-dev libglib2.0-dev tcl-dev tk-dev |
| 22 | +# Required Python packages |
| 23 | +python -m pip install scikit-build |
| 24 | + |
| 25 | +python setup.py install |
| 26 | +``` |
| 27 | + |
| 28 | +## Usage |
| 29 | +Simply import the package, and the theme is loaded automatically. |
| 30 | +```python |
| 31 | +import tkinter as tk |
| 32 | +from tkinter import ttk |
| 33 | +import gttk |
| 34 | + |
| 35 | +window = tk.Tk() |
| 36 | +style = ttk.Style() |
| 37 | +style.theme_use("gttk") |
| 38 | +ttk.Button(window, text="Destroy", command=window.destroy).pack() |
| 39 | + |
| 40 | +window.mainloop() |
| 41 | +``` |
| 42 | + |
| 43 | +If you encounter an error because you are running in the repository, |
| 44 | +directory, make sure to disallow imports from the working directory |
| 45 | +before importing `gttk`: |
| 46 | +```python |
| 47 | +import sys |
| 48 | +sys.path = sys.path[2:] |
| 49 | +import gttk |
| 50 | +``` |
| 51 | + |
| 52 | +## Screenshots |
| 53 | +`gttk` should work with any GTK theme you can throw at it, but below |
| 54 | +are the themes Yaru and Adwaita as examples. |
| 55 | + |
| 56 | + |
| 57 | + |
| 58 | + |
| 59 | +## License and Copyright |
| 60 | +This repository provides a wrapper around `gttk`, which is a renamed |
| 61 | +version of `gtkTtk`, which in turn is a renamed version of `tile-gtk`. |
| 62 | +The original `tile-gtk` is available under hte MIT License. This version |
| 63 | +is available only under GNU GPLv3. |
| 64 | + |
| 65 | +``` |
| 66 | + python-gttk |
| 67 | + Copyright (c) 2008-2012 Georgios Petasis |
| 68 | + Copyright (c) 2012 Cheer Xiao |
| 69 | + Copyright (c) 2019-2020 Geballin |
| 70 | + Copyright (c) 2020 RedFantom |
| 71 | + |
| 72 | + This program is free software: you can redistribute it and/or modify |
| 73 | + it under the terms of the GNU General Public License as published by |
| 74 | + the Free Software Foundation, either version 3 of the License, or |
| 75 | + (at your option) any later version. |
| 76 | + |
| 77 | + This program is distributed in the hope that it will be useful, |
| 78 | + but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 79 | + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 80 | + GNU General Public License for more details. |
| 81 | + |
| 82 | + You should have received a copy of the GNU General Public License |
| 83 | + along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 84 | +``` |
| 85 | + |
| 86 | +## Project State |
| 87 | +`tile-gtk`, `gtkTtk` and hence also `gttk` are far from perfect. You may |
| 88 | +encounter various graphical artifacts when using particular themes, |
| 89 | +while others work without flaws. |
| 90 | + |
| 91 | +You are welcome to report any issues, and pull requests are even better. |
0 commit comments