Skip to main content

Make Tkinter apps in an easy way using JSON.

Project description

EasyTk

Create Tkinter applications with help of JSON!

test = EasyTkObject()
test.create_root()
test.open_file("json/test.json")
test.reading_from_json()
test.start_root()

Installation

If you don't have tkinter installed in your environment,install it:

pip install tkintertable

then install this package.

Usage

JSON strucuture:
{
...,
  "Frame1": {
    "layout": "grid",
    "methods": [0,1,2],
    "master": "FrameContainer",
    "config": {},
    "grid": {"sticky": "NSEW"},
    "newRow": false
  },...
}

You stat with name of widget,for example: Frame1:{...},"LabelUsername":{...},"ButtonConfirm":{...},...

layout - currently you can use grid and pack "layout":"grid" or "layout:"pack"

methods - inside this list you can include indexes of methods that you will use,this is explained in Python part

master - to which master does this widget belong,be aware of which layout manager is used and that master exists

config - for example: "config":{"text":"TEST"}

grid - if you decided to use grid as layout then fill this with proper data,you don't have to include row and column,for example: "Button1":{...},Button2":{...},Button3":{..., "newRow":true },

Button1 is on row=0,column=0,Button2 is on row=0,column=1 and Button3 is on row=1,column=0. But you can also include row and column if you want.

pack - if layout is pack then include here attributes,or leave it blank.

If you use pack then it's necessary to include it in JSON object even if you don't have any value. For example:

...,
"Canvas": {
    "master": "Frame0",
    "layout": "pack",
    "pack": {"side":"left", "fill":"both", "expand":true},
    "config": {},
    "methods": [1]
  },
"Scrollbar": {
    "master": "Frame0",
    "layout": "pack",
    "pack": {},
    "config": {"orient": "vertical"},
    "methods": [2]
},
...

Both widgets work. And same applies to grid.

newRow - if layout is grid then use boolean value.

Python
from easy_tk import EasyTkObject

This class has all methods you need for "converting" JSON to Tkinter app.EasyTkObject mainly use EasyTk methods but in different way. You can override them.

  • create_root()
  • get(name,obj=True)- getting object of one widget if obj were False then you will get EasyTkChild object
  • import_methods(methods=[]) - put all your methods in list and use this method
  • import_modules(modules=[]) - put all your modules here,you can include your own widgets,default is this ["Frame","Entry","Button","Label","Separator","Radiobutton","Canvas","Scrollbar"],you can extend it
  • open_file(file) - setting your json file EasyTk
  • reading_from_json() - adding every widget to screen
  • add_just_one(file,key) - adding just one widget from json(again be sure that master there exist)
  • easy_factory() - factory for EasyTk object

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

easy_tk-1.0.tar.gz (6.8 kB view details)

Uploaded Source

Built Distribution

easy_tk-1.0-py3-none-any.whl (7.7 kB view details)

Uploaded Python 3

File details

Details for the file easy_tk-1.0.tar.gz.

File metadata

  • Download URL: easy_tk-1.0.tar.gz
  • Upload date:
  • Size: 6.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.24.0 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.51.0 CPython/3.8.2

File hashes

Hashes for easy_tk-1.0.tar.gz
Algorithm Hash digest
SHA256 168b481c8a44678b76a151200f5a6d26aee89a63f979c7e8f36a0778ffb74097
MD5 79841e0499c620fae45e5efea5516ca3
BLAKE2b-256 388b7709160516a7c3bc5f2a7e56aaeb0e8faadae95a7311b7bdf488299ebe1c

See more details on using hashes here.

File details

Details for the file easy_tk-1.0-py3-none-any.whl.

File metadata

  • Download URL: easy_tk-1.0-py3-none-any.whl
  • Upload date:
  • Size: 7.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.24.0 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.51.0 CPython/3.8.2

File hashes

Hashes for easy_tk-1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 56ce61162aca0d9e97b50cda5f7c6bd084caa64cf5c6111bcbd8ce9289d7375c
MD5 3ca7937870245769a55aa8ee47a92034
BLAKE2b-256 ad36d549c181b052b38da0b8f6cc995b5f0e122caf2f47b83f9234ad6c17f984

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page