├── .gitignore ├── README.md ├── docs ├── Makefile ├── app │ ├── app.rst │ ├── calc1.png │ ├── calc1.py │ ├── calc2.png │ ├── calc2.py │ ├── calc3.png │ ├── calc3.py │ ├── calc4.png │ ├── calc4.py │ └── tklib.py ├── basic │ ├── basic.rst │ ├── button1.png │ ├── button1.py │ ├── button2.png │ ├── button2.py │ ├── font1.png │ ├── font1.py │ ├── frame1.png │ ├── frame1.py │ ├── frame2.png │ ├── frame2.py │ ├── icons │ │ ├── address-book-alt.png │ │ ├── address-book.png │ │ ├── bag.png │ │ ├── basket.png │ │ ├── beer.png │ │ ├── bell.png │ │ ├── bitcoin.png │ │ ├── book-bookmark.png │ │ ├── book.png │ │ ├── box-full.png │ │ ├── box-in.png │ │ ├── box-out.png │ │ ├── box.png │ │ ├── brick-alt.png │ │ ├── brick.png │ │ ├── bubble.png │ │ ├── bubbles-alt.png │ │ ├── bubbles.png │ │ ├── building.png │ │ ├── bullhorn.png │ │ ├── calculator.png │ │ ├── calendar-clock.png │ │ ├── calendar.png │ │ ├── carton.png │ │ ├── cat.png │ │ ├── clock.png │ │ ├── cloud-down.png │ │ ├── cloud-sync.png │ │ ├── cloud-up.png │ │ ├── cloud.png │ │ ├── cog.png │ │ ├── cogs.png │ │ ├── compass.png │ │ ├── cone.png │ │ ├── dashboard-alt.png │ │ ├── dashboard.png │ │ ├── database.png │ │ ├── device-camera.png │ │ ├── device-computer.png │ │ ├── device-drive.png │ │ ├── device-laptop.png │ │ ├── device-mobile-phone.png │ │ ├── device-tablet.png │ │ ├── device-tv.png │ │ ├── disc-vinyl.png │ │ ├── disc.png │ │ ├── drop.png │ │ ├── envelope-letter.png │ │ ├── envelope.png │ │ ├── file-bookmark.png │ │ ├── file-code.png │ │ ├── file-empty.png │ │ ├── file-excel.png │ │ ├── file-exe.png │ │ ├── file-font.png │ │ ├── file-illustrator.png │ │ ├── file-indesign.png │ │ ├── file-link.png │ │ ├── file-note.png │ │ ├── file-pdf.png │ │ ├── file-photoshop.png │ │ ├── file-picture.png │ │ ├── file-powerpoint.png │ │ ├── file-premiere.png │ │ ├── file-sound.png │ │ ├── file-text.png │ │ ├── file-video.png │ │ ├── file-word.png │ │ ├── file-zip.png │ │ ├── flag-alt.png │ │ ├── flag.png │ │ ├── flask.png │ │ ├── floppy.png │ │ ├── flower.png │ │ ├── folder-document.png │ │ ├── folder-house.png │ │ ├── folder-music.png │ │ ├── folder-picture.png │ │ ├── folder-video.png │ │ ├── folder.png │ │ ├── funnel.png │ │ ├── gamepad.png │ │ ├── gift.png │ │ ├── globe.png │ │ ├── handshake.png │ │ ├── headphone.png │ │ ├── heart.png │ │ ├── house.png │ │ ├── institution.png │ │ ├── key.png │ │ ├── keyring.png │ │ ├── layers.png │ │ ├── life-buoy.png │ │ ├── light-bulb.png │ │ ├── lightning.png │ │ ├── lock-open.png │ │ ├── lock.png │ │ ├── magnify-less.png │ │ ├── magnify.png │ │ ├── map-map-marker.png │ │ ├── map-marker.png │ │ ├── map.png │ │ ├── microphone.png │ │ ├── mixer.png │ │ ├── money.png │ │ ├── monitor.png │ │ ├── news.png │ │ ├── notepad.png │ │ ├── paper-plane.png │ │ ├── paperclip.png │ │ ├── pencil.png │ │ ├── phone.png │ │ ├── pin.png │ │ ├── post-it.png │ │ ├── profile-group.png │ │ ├── profile.png │ │ ├── puzzle.png │ │ ├── radio.png │ │ ├── rss.png │ │ ├── safe.png │ │ ├── search.png │ │ ├── shield-error.png │ │ ├── shield-ok.png │ │ ├── shield-warning.png │ │ ├── shield.png │ │ ├── shop.png │ │ ├── sign-add.png │ │ ├── sign-ban.png │ │ ├── sign-check.png │ │ ├── sign-delete.png │ │ ├── sign-down.png │ │ ├── sign-error.png │ │ ├── sign-info.png │ │ ├── sign-left.png │ │ ├── sign-question.png │ │ ├── sign-right.png │ │ ├── sign-sync.png │ │ ├── sign-up.png │ │ ├── sign-warning.png │ │ ├── skull.png │ │ ├── snow-flake.png │ │ ├── social-facebook.png │ │ ├── social-google-plus.png │ │ ├── social-twitter.png │ │ ├── social-youtube.png │ │ ├── stamp.png │ │ ├── star-alt.png │ │ ├── star.png │ │ ├── sun.png │ │ ├── switch-off.png │ │ ├── switch-on.png │ │ ├── tag-alt.png │ │ ├── tag.png │ │ ├── terminal.png │ │ ├── thumb-up.png │ │ ├── trashcan-full.png │ │ ├── trashcan.png │ │ ├── user-female-alt.png │ │ ├── user-female.png │ │ ├── user-id.png │ │ ├── user-male-alt.png │ │ ├── user-male.png │ │ ├── webcam.png │ │ ├── window-layout.png │ │ ├── window-system.png │ │ ├── window.png │ │ ├── wine.png │ │ ├── wrench-screwdriver.png │ │ └── wrench.png │ ├── label1.png │ ├── label1.py │ ├── label2.png │ ├── label2.py │ ├── label3.png │ ├── label3.py │ ├── label4.png │ ├── label4.py │ ├── style1.png │ ├── style1.py │ ├── style2.png │ ├── style2.py │ ├── style3.py │ ├── template.png │ ├── template.py │ └── tklib.py ├── button │ ├── bind1.png │ ├── bind1.py │ ├── button.rst │ ├── button0.py │ ├── button1.png │ ├── button1.py │ ├── button2.png │ ├── button2.py │ ├── button3.py │ ├── button4.py │ ├── frame1.png │ ├── frame1.py │ ├── label1.png │ ├── label1.py │ ├── label2.py │ └── tklib.py ├── canvas │ ├── canvas.rst │ ├── canvas1.png │ ├── canvas1.py │ ├── canvas2.png │ ├── canvas2.py │ ├── canvas3.png │ ├── canvas3.py │ ├── canvas4.png │ ├── canvas4.py │ ├── canvas5.png │ ├── canvas5.py │ ├── canvas6.png │ ├── canvas6.py │ ├── canvas7.png │ ├── canvas7.py │ ├── canvas8.png │ ├── canvas8.py │ ├── canvas9.png │ ├── canvas9.py │ ├── draw1.png │ ├── draw1.py │ ├── draw2.py │ └── tklib.py ├── check │ ├── check.rst │ ├── check1.png │ ├── check1.py │ ├── check2.py │ └── check3.py ├── conf.py ├── entry │ ├── combo1.png │ ├── combo1.py │ ├── combo2.png │ ├── combo2.py │ ├── combo3.png │ ├── combo3.py │ ├── combo4.png │ ├── combo4.py │ ├── demo.py │ ├── entry.png │ ├── entry.py │ ├── entry.rst │ ├── entry0.png │ ├── entry0.py │ ├── entry1.png │ ├── entry1.py │ ├── entry2.png │ ├── entry2.py │ ├── scale1.png │ ├── scale1.py │ ├── scale2.png │ ├── scale2.py │ ├── spinbox1.png │ ├── spinbox1.py │ ├── spinbox2.png │ ├── spinbox2.py │ ├── template.png │ ├── template.py │ └── tklib.py ├── event │ ├── event.rst │ ├── event1.png │ ├── event1.py │ ├── event2.png │ ├── event2.py │ ├── event3.png │ ├── event3.py │ ├── event4.png │ ├── event4.py │ └── tklib.py ├── grid │ ├── frame1.png │ ├── frame1.py │ ├── grid.rst │ ├── grid1.py │ └── grid2.py ├── index.rst ├── intro │ ├── .DS_Store │ ├── intro.py │ ├── intro.rst │ ├── intro1.png │ ├── intro1.py │ ├── intro2.png │ ├── intro2.py │ ├── intro3.png │ ├── intro3.py │ ├── intro4.py │ ├── intro4b.py │ ├── intro5.png │ ├── intro5.py │ ├── intro6.png │ ├── intro6.py │ ├── intro7.png │ ├── intro7.py │ ├── intro8.png │ ├── intro8.py │ ├── python_logo.png │ ├── template.py │ └── tklib.py ├── listbox │ ├── lb1.png │ ├── lb1.py │ ├── lb2.png │ ├── lb2.py │ ├── lb2_.png │ ├── lb2_.py │ ├── lb3.png │ ├── lb3.py │ ├── lb4.png │ ├── lb4.py │ ├── lb5.png │ ├── lb5.py │ ├── listbox.rst │ ├── listbox4.png │ ├── listbox4.py │ ├── listbox5.png │ ├── listbox5.py │ ├── listbox6.png │ ├── listbox6.py │ ├── re1.png │ ├── re1.py │ ├── re2.png │ ├── re2.py │ └── tklib.py ├── make.bat ├── menu │ ├── menu.rst │ ├── menu1.png │ ├── menu1.py │ ├── menu2.png │ ├── menu2.py │ ├── menu3.png │ ├── menu3.py │ ├── menu4.png │ ├── menu4.py │ ├── menu5.png │ ├── menu5.py │ ├── menu6.png │ ├── menu6.py │ ├── menu7.png │ ├── menu7.py │ ├── menu8.png │ ├── menu8.py │ ├── menu9.png │ ├── menu9.py │ └── tklib.py ├── notes.md ├── radio │ ├── radio.rst │ ├── radio1.png │ ├── radio1.py │ ├── radio2.py │ ├── radio3.py │ ├── radio4.png │ ├── radio4.py │ ├── radio5.png │ ├── radio5.py │ └── tklib.py ├── requirements.txt ├── scrollbar │ ├── scrollbar.rst │ ├── scrollbar1.png │ ├── scrollbar1.py │ ├── scrollbar2.png │ ├── scrollbar2.py │ ├── scrollbar3.png │ ├── scrollbar3.py │ ├── scrollbar4.py │ ├── scrollbar5.png │ ├── scrollbar5.py │ └── tklib.py ├── temp │ └── testing.py ├── text │ ├── text.rst │ ├── text1.png │ ├── text1.py │ ├── text2.png │ ├── text2.py │ ├── text3.png │ ├── text3.py │ ├── text4.png │ ├── text4.py │ ├── text5.png │ ├── text5.py │ ├── text6.png │ ├── text6.py │ ├── text7.png │ ├── text7.py │ ├── text8.png │ ├── text8.py │ └── tklib.py ├── time │ ├── time.rst │ ├── time1.png │ ├── time1.py │ ├── time2.png │ ├── time2.py │ ├── time2_.png │ └── tklib.py ├── tree │ ├── browser1.png │ ├── browser1.py │ ├── browser2.png │ ├── browser2.py │ ├── browser3.png │ ├── browser3.py │ ├── browser4.py │ ├── files1.py │ ├── inspector.py │ ├── tklib.py │ ├── tree.rst │ ├── tree0.png │ ├── tree0.py │ ├── tree1.png │ ├── tree1.py │ ├── tree1_bind.png │ ├── tree1_bind.py │ ├── tree1_col.png │ ├── tree1_col.py │ ├── tree1_tag.png │ ├── tree1_tag.py │ ├── tree2.png │ ├── tree2.py │ ├── tree3.png │ ├── tree4.png │ ├── tree4.py │ ├── tree5.png │ ├── tree5.py │ ├── tree6.png │ ├── tree6.py │ ├── tree7.png │ ├── tree7.py │ ├── tree8.png │ ├── tree8.py │ ├── tree9.png │ └── tree9.py └── window │ ├── dialog1.png │ ├── dialog1.py │ ├── dialog2.py │ ├── dialog_open.png │ ├── statusbar1.png │ ├── statusbar1.py │ ├── statusbar2.png │ ├── statusbar2.py │ ├── tklib.py │ ├── window.rst │ ├── window1.png │ ├── window1.py │ ├── window2.png │ ├── window2.py │ ├── window3.png │ ├── window3.py │ ├── window4.png │ ├── window4.py │ ├── window5.png │ ├── window5.py │ ├── window6.png │ ├── window6.py │ ├── window7.png │ ├── window7.py │ ├── window8.png │ └── window8.py ├── test ├── test_button.py ├── test_label.py ├── test_sample.py └── tklib.py └── tklib.py /.gitignore: -------------------------------------------------------------------------------- 1 | # Byte-compiled / optimized / DLL files 2 | __pycache__/ 3 | *.py[cod] 4 | *$py.class 5 | 6 | # C extensions 7 | *.so 8 | 9 | # Distribution / packaging 10 | .Python 11 | build/ 12 | develop-eggs/ 13 | dist/ 14 | downloads/ 15 | eggs/ 16 | .eggs/ 17 | lib/ 18 | lib64/ 19 | parts/ 20 | sdist/ 21 | var/ 22 | wheels/ 23 | *.egg-info/ 24 | .installed.cfg 25 | *.egg 26 | MANIFEST 27 | 28 | # PyInstaller 29 | # Usually these files are written by a python script from a template 30 | # before PyInstaller builds the exe, so as to inject date/other infos into it. 31 | *.manifest 32 | *.spec 33 | 34 | # Installer logs 35 | pip-log.txt 36 | pip-delete-this-directory.txt 37 | 38 | # Unit test / coverage reports 39 | htmlcov/ 40 | .tox/ 41 | .coverage 42 | .coverage.* 43 | .cache 44 | nosetests.xml 45 | coverage.xml 46 | *.cover 47 | .hypothesis/ 48 | .pytest_cache/ 49 | 50 | # Translations 51 | *.mo 52 | *.pot 53 | 54 | # Django stuff: 55 | *.log 56 | local_settings.py 57 | db.sqlite3 58 | 59 | # Flask stuff: 60 | instance/ 61 | .webassets-cache 62 | 63 | # Scrapy stuff: 64 | .scrapy 65 | 66 | # Sphinx documentation 67 | docs/_build/ 68 | 69 | # PyBuilder 70 | target/ 71 | 72 | # Jupyter Notebook 73 | .ipynb_checkpoints 74 | 75 | # pyenv 76 | .python-version 77 | 78 | # celery beat schedule file 79 | celerybeat-schedule 80 | 81 | # SageMath parsed files 82 | *.sage.py 83 | 84 | # Environments 85 | .env 86 | .venv 87 | env/ 88 | venv/ 89 | ENV/ 90 | env.bak/ 91 | venv.bak/ 92 | 93 | # Spyder project settings 94 | .spyderproject 95 | .spyproject 96 | 97 | # Rope project settings 98 | .ropeproject 99 | 100 | # mkdocs documentation 101 | /site 102 | 103 | # mypy 104 | .mypy_cache/ 105 | .DS_Store 106 | .vscode 107 | .pytest_cache -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | Introduction to Tk 2 | ================== 3 | 4 | Tk is a **graphical user interface** (GUI) library. It allows to create windows, buttons and all the other graphical elements. 5 | 6 | This tutorial shows how to use **object-oriented programming** (OOP) 7 | for making applications with the **Tk** framework. 8 | 9 | You can find the online tutorial here: https://tk-tutorial.readthedocs.io 10 | 11 | More tutorials 12 | -------------- 13 | 14 | * https://opencv-tutorial.readthedocs.io 15 | * https://pymunk-tutorial.readthedocs.io 16 | * https://cocos2d-tutorial.readthedocs.io 17 | * https://sqlite-tutorial.readthedocs.io 18 | * https://ev3-tutorial.readthedocs.io 19 | * https://tk-tutorial.readthedocs.io 20 | * https://pygame.readthedocs.io -------------------------------------------------------------------------------- /docs/Makefile: -------------------------------------------------------------------------------- 1 | # Minimal makefile for Sphinx documentation 2 | # 3 | 4 | # You can set these variables from the command line. 5 | SPHINXOPTS = 6 | SPHINXBUILD = sphinx-build 7 | SOURCEDIR = . 8 | BUILDDIR = _build 9 | 10 | # Put it first so that "make" without argument is like "make help". 11 | help: 12 | @$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) 13 | 14 | .PHONY: help Makefile 15 | 16 | # Catch-all target: route all unknown targets to Sphinx using the new 17 | # "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS). 18 | %: Makefile 19 | @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) -------------------------------------------------------------------------------- /docs/app/app.rst: -------------------------------------------------------------------------------- 1 | Applications 2 | ============ 3 | 4 | In this section we are showing some practical applications. 5 | 6 | Calculator 7 | ---------- 8 | 9 | The first example is a pocket calculator. 10 | 11 | First, we just do the layout for the buttons:: 12 | 13 | App.lb = Label('0.0') 14 | App.lb.grid(columnspan=4) 15 | 16 | Button('AC', ).grid(row=1) 17 | Button('±').grid(row=1, column=1) 18 | Button('%').grid(row=1, column=2) 19 | Button(':').grid(row=1, column=3) 20 | 21 | .. image:: calc1.png 22 | 23 | .. literalinclude:: calc1.py 24 | 25 | :download:`calc1.py` 26 | 27 | Then we are going to add callback functions to the keys:: 28 | 29 | Button('7', 'App.lb["text"] = float(App.lb["text"])*10 + 7').grid(row=2, column=0) 30 | Button('8', 'App.lb["text"] = float(App.lb["text"])*10 + 8').grid(row=2, column=1) 31 | Button('9', 'App.lb["text"] = float(App.lb["text"])*10 + 9').grid(row=2, column=2) 32 | Button('x').grid(row=2, column=3) 33 | 34 | .. image:: calc2.png 35 | 36 | .. literalinclude:: calc2.py 37 | 38 | :download:`calc2.py` 39 | 40 | It turns out that it is simpler to place the calculator logic into 41 | a separate function, based on a single character:: 42 | 43 | def calculate(self, c): 44 | """Calculator for 4 basic operations.""" 45 | if c in '0123456789.±+-/*%c=': 46 | if c in '0123456789': 47 | if self.pos: 48 | self.val += int(c) * 10**self.pos 49 | self.pos -= 1 50 | else: 51 | self.val *= 10 52 | self.val += int(c) 53 | if c == '.': 54 | self.pos = -1 55 | if c == '%': 56 | self.val *= 0.01 57 | elif c in '+-/*': 58 | self.val2 = self.val 59 | self.val = 0 60 | self.pos = 0 61 | self.op = c 62 | elif c == '=': 63 | e = str(self.val2) + self.op + str(self.val) 64 | self.val = eval(e) 65 | if c == 'c': 66 | self.val = 0 67 | self.pos = 0 68 | 69 | self.lb['text'] = self.val 70 | 71 | .. image:: calc3.png 72 | 73 | .. literalinclude:: calc3.py 74 | 75 | :download:`calc3.py` 76 | 77 | And finally we put everything together. 78 | New Calculator instances can be created via a button press or via a menu. 79 | 80 | .. image:: calc4.png 81 | 82 | .. literalinclude:: calc4.py 83 | 84 | :download:`calc4.py` -------------------------------------------------------------------------------- /docs/app/calc1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rasql/tk-tutorial/e7a7697afc7fa975a4608c6305edd5bff03bfe9d/docs/app/calc1.png -------------------------------------------------------------------------------- /docs/app/calc1.py: -------------------------------------------------------------------------------- 1 | """Create calculator buttons.""" 2 | from tklib import * 3 | 4 | class Demo(App): 5 | def __init__(self): 6 | super().__init__() 7 | 8 | App.lb = Label('0.0') 9 | App.lb.grid(columnspan=4) 10 | 11 | Button('AC', ).grid(row=1) 12 | Button('±').grid(row=1, column=1) 13 | Button('%').grid(row=1, column=2) 14 | Button(':').grid(row=1, column=3) 15 | 16 | Button('7').grid(row=2, column=0) 17 | Button('8').grid(row=2, column=1) 18 | Button('9').grid(row=2, column=2) 19 | Button('x').grid(row=2, column=3) 20 | 21 | Button('4').grid(row=3, column=0) 22 | Button('5').grid(row=3, column=1) 23 | Button('6').grid(row=3, column=2) 24 | Button('-').grid(row=3, column=3) 25 | 26 | Button('1').grid(row=4, column=0) 27 | Button('2').grid(row=4, column=1) 28 | Button('3').grid(row=4, column=2) 29 | Button('+').grid(row=4, column=3) 30 | 31 | Button('0').grid(row=5, columnspan=2, sticky='we') 32 | Button('.').grid(row=5, column=2) 33 | Button('=').grid(row=5, column=3) 34 | 35 | if __name__ == '__main__': 36 | Demo().run() -------------------------------------------------------------------------------- /docs/app/calc2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rasql/tk-tutorial/e7a7697afc7fa975a4608c6305edd5bff03bfe9d/docs/app/calc2.png -------------------------------------------------------------------------------- /docs/app/calc2.py: -------------------------------------------------------------------------------- 1 | """Create calculator buttons.""" 2 | from tklib import * 3 | 4 | class Demo(App): 5 | def __init__(self): 6 | super().__init__() 7 | 8 | s = ttk.Style() 9 | s.configure('TButton', font='Arial 18', padding=5) 10 | 11 | App.lb = Label('0', font='Arial 36') 12 | App.lb.grid(columnspan=4, sticky='e') 13 | 14 | Button('C', 'App.lb["text"] = 0.0').grid(row=1) 15 | Button('±').grid(row=1, column=1) 16 | Button('%').grid(row=1, column=2) 17 | Button(':').grid(row=1, column=3) 18 | 19 | Button('7', 'App.lb["text"] = float(App.lb["text"])*10 + 7').grid(row=2, column=0) 20 | Button('8', 'App.lb["text"] = float(App.lb["text"])*10 + 8').grid(row=2, column=1) 21 | Button('9', 'App.lb["text"] = float(App.lb["text"])*10 + 9').grid(row=2, column=2) 22 | Button('x').grid(row=2, column=3) 23 | 24 | Button('4', 'App.lb["text"] = float(App.lb["text"])*10 + 4').grid(row=3, column=0) 25 | Button('5', 'App.lb["text"] = float(App.lb["text"])*10 + 5').grid(row=3, column=1) 26 | Button('6', 'App.lb["text"] = float(App.lb["text"])*10 + 6').grid(row=3, column=2) 27 | Button('-').grid(row=3, column=3) 28 | 29 | Button('1', 'App.lb["text"] = float(App.lb["text"])*10 + 1').grid(row=4, column=0) 30 | Button('2', 'App.lb["text"] = float(App.lb["text"])*10 + 2').grid(row=4, column=1) 31 | Button('3', 'App.lb["text"] = float(App.lb["text"])*10 + 3').grid(row=4, column=2) 32 | Button('+').grid(row=4, column=3) 33 | 34 | Button('0', 'App.lb["text"] = float(App.lb["text"])*10 + 0').grid(row=5, columnspan=2, sticky='we') 35 | Button('.').grid(row=5, column=2) 36 | Button('=').grid(row=5, column=3) 37 | 38 | if __name__ == '__main__': 39 | Demo().run() -------------------------------------------------------------------------------- /docs/app/calc3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rasql/tk-tutorial/e7a7697afc7fa975a4608c6305edd5bff03bfe9d/docs/app/calc3.png -------------------------------------------------------------------------------- /docs/app/calc3.py: -------------------------------------------------------------------------------- 1 | """Create calculator buttons.""" 2 | from tklib import * 3 | 4 | class Demo(App): 5 | def __init__(self): 6 | super().__init__() 7 | 8 | s = ttk.Style() 9 | s.configure('TButton', font='Arial 18', padding=5) 10 | 11 | self.lb = Label('0', font='Arial 36', width=15, anchor='e') 12 | 13 | self.val = 0 14 | self.pos = 0 15 | self.val2 = 0 16 | 17 | App.root.bind('', self.cb) 18 | 19 | def cb(self, event=None): 20 | """React to key press events.""" 21 | c = event.char 22 | if c != '': 23 | self.calculate(c) 24 | 25 | def calculate(self, c): 26 | """Calculator for 4 basic operations.""" 27 | if c in '0123456789.±+-/*%c=': 28 | if c in '0123456789': 29 | if self.pos: 30 | self.val += int(c) * 10**self.pos 31 | self.pos -= 1 32 | else: 33 | self.val *= 10 34 | self.val += int(c) 35 | if c == '.': 36 | self.pos = -1 37 | if c == '%': 38 | self.val *= 0.01 39 | elif c in '+-/*': 40 | self.val2 = self.val 41 | self.val = 0 42 | self.pos = 0 43 | self.op = c 44 | elif c == '=': 45 | e = str(self.val2) + self.op + str(self.val) 46 | self.val = eval(e) 47 | if c == 'c': 48 | self.val = 0 49 | self.pos = 0 50 | 51 | self.lb['text'] = self.val 52 | 53 | if __name__ == '__main__': 54 | Demo().run() -------------------------------------------------------------------------------- /docs/app/calc4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rasql/tk-tutorial/e7a7697afc7fa975a4608c6305edd5bff03bfe9d/docs/app/calc4.png -------------------------------------------------------------------------------- /docs/app/calc4.py: -------------------------------------------------------------------------------- 1 | """Create calculator buttons.""" 2 | from tklib import * 3 | 4 | class Calculator(): 5 | def __init__(self): 6 | self.win = Window('Calculator') 7 | s = ttk.Style() 8 | s.configure('TButton', font='Arial 18', padding=5) 9 | 10 | self.lb = Label('0', font='Arial 44', width=15, anchor='e') 11 | self.lb.grid(columnspan=4) 12 | 13 | buttons = 'c±%/789*456-123+ 0.=' 14 | for i, b in enumerate(buttons): 15 | Button(b, lambda c=b: self.calculate(c)).grid(row=i//4+1, column=i%4) 16 | self.val = 0 17 | self.pos = 0 18 | self.val2 = 0 19 | self.op = '' 20 | 21 | self.win.top.bind('', self.cb) 22 | 23 | def cb(self, event=None): 24 | """React to key press events.""" 25 | c = event.char 26 | if c != '': 27 | self.calculate(c) 28 | 29 | def calculate(self, c): 30 | """Calculator for 4 basic operations.""" 31 | if c in '0123456789.±+-/*%c=': 32 | if c in '0123456789': 33 | if self.pos: 34 | self.val += int(c) * 10**self.pos 35 | self.pos -= 1 36 | else: 37 | self.val *= 10 38 | self.val += int(c) 39 | elif c == '.': 40 | self.pos = -1 41 | elif c == '%': 42 | self.val *= 0.01 43 | elif c == '±': 44 | self.val *= -1 45 | elif c in '+-/*': 46 | self.val2 = self.val 47 | self.val = 0 48 | self.pos = 0 49 | self.op = c 50 | elif c == '=': 51 | e = str(self.val2) + self.op + str(self.val) 52 | self.val = eval(e) 53 | if c == 'c': 54 | self.val = 0 55 | self.pos = 0 56 | 57 | self.lb['text'] = self.val 58 | 59 | 60 | class Demo(App): 61 | def __init__(self): 62 | super().__init__() 63 | Button('New calculator', Calculator) 64 | Menu('App') 65 | Item('Calculator', Calculator) 66 | 67 | if __name__ == '__main__': 68 | Demo().run() -------------------------------------------------------------------------------- /docs/app/tklib.py: -------------------------------------------------------------------------------- 1 | ../../tklib.py -------------------------------------------------------------------------------- /docs/basic/basic.rst: -------------------------------------------------------------------------------- 1 | Basic widgets 2 | ============= 3 | 4 | In this section we are going to look in more detail at these basic widgets: 5 | 6 | * Button 7 | * Label 8 | * Entry 9 | * Frame 10 | 11 | Button 12 | ------ 13 | 14 | Buttons have text, a command and keyword arguements:: 15 | 16 | Button() 17 | Button('Print 123', 'print(123)', padding=10) 18 | Button('Hello', 'print("Hello " * 3)', default='active') 19 | 20 | The first button has the default text *Button* and does nothing. 21 | 22 | The second button has a padding of 10 pixels and prints 23 | ``.!frame.!button2`` 24 | 25 | The third button is active by default and prints:: 26 | ``Hello Hello Hello`` 27 | 28 | .. image:: button1.png 29 | 30 | .. literalinclude:: button1.py 31 | 32 | :download:`button1.py` 33 | 34 | 35 | Buttons which create buttons 36 | ---------------------------- 37 | 38 | Buttons can also be created or deleted dynamically: 39 | 40 | * The first button creates another default button. 41 | * The second button creates a self-destroy button. 42 | 43 | .. image:: button2.png 44 | 45 | .. literalinclude:: button2.py 46 | 47 | :download:`button2.py` 48 | 49 | 50 | Fonts 51 | ----- 52 | 53 | Labels can use different fonts and size. 54 | 55 | .. image:: font1.png 56 | 57 | .. literalinclude:: font1.py 58 | 59 | :download:`font1.py` 60 | 61 | 62 | Display a label with an image with 63 | ---------------------------------- 64 | 65 | Labels can be displayed with an additional image. 66 | The image position can be: 67 | 68 | * center 69 | * left/right 70 | * top/bottom 71 | 72 | .. image:: label1.png 73 | 74 | .. literalinclude:: label1.py 75 | 76 | :download:`label1.py` 77 | 78 | 79 | Display a images as labels 80 | -------------------------- 81 | 82 | .. image:: label2.png 83 | 84 | .. literalinclude:: label2.py 85 | 86 | :download:`label2.py` 87 | 88 | 89 | 90 | Display a images as buttons 91 | --------------------------- 92 | 93 | .. image:: label3.png 94 | 95 | .. literalinclude:: label3.py 96 | 97 | :download:`label3.py` 98 | 99 | 100 | Display a images in a listbox 101 | ----------------------------- 102 | 103 | .. image:: label4.png 104 | 105 | .. literalinclude:: label4.py 106 | 107 | :download:`label4.py` 108 | 109 | 110 | Embedded frames 111 | --------------- 112 | 113 | .. image:: frame1.png 114 | 115 | .. literalinclude:: frame1.py 116 | 117 | :download:`frame1.py` 118 | 119 | 120 | Embedded frames 121 | --------------- 122 | 123 | .. image:: frame2.png 124 | 125 | .. literalinclude:: frame2.py 126 | 127 | :download:`frame2.py` 128 | -------------------------------------------------------------------------------- /docs/basic/button1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rasql/tk-tutorial/e7a7697afc7fa975a4608c6305edd5bff03bfe9d/docs/basic/button1.png -------------------------------------------------------------------------------- /docs/basic/button1.py: -------------------------------------------------------------------------------- 1 | """Create buttons with actions.""" 2 | from tklib import * 3 | 4 | class Demo(App): 5 | """Create different buttons.""" 6 | def __init__(self): 7 | super().__init__() 8 | App.root.title('Button Demo') 9 | 10 | Button() 11 | Button('Print self', 'print(self)', padding=10) 12 | Button('Hello', 'print("Hello " * 3)', default='active') 13 | 14 | Demo().run() -------------------------------------------------------------------------------- /docs/basic/button2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rasql/tk-tutorial/e7a7697afc7fa975a4608c6305edd5bff03bfe9d/docs/basic/button2.png -------------------------------------------------------------------------------- /docs/basic/button2.py: -------------------------------------------------------------------------------- 1 | """Buttons which create other buttons.""" 2 | from tklib import * 3 | 4 | class Demo(App): 5 | """Create different buttons.""" 6 | def __init__(self): 7 | super().__init__() 8 | App.root.title('Button Demo') 9 | 10 | Button('Add Button', 'Button()') 11 | Button('Add self-destroy button', 'Button("Destroy", "self.destroy()")') 12 | 13 | Demo().run() -------------------------------------------------------------------------------- /docs/basic/font1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rasql/tk-tutorial/e7a7697afc7fa975a4608c6305edd5bff03bfe9d/docs/basic/font1.png -------------------------------------------------------------------------------- /docs/basic/font1.py: -------------------------------------------------------------------------------- 1 | """Show different fonts.""" 2 | from tklib import * 3 | 4 | class Demo(App): 5 | def __init__(self): 6 | super().__init__() 7 | 8 | fonts = ['Times', 'Courier', 'Helvetica', 'Didot'] 9 | for x in fonts: 10 | Label(x, font=x+' 36') 11 | 12 | Demo().run() -------------------------------------------------------------------------------- /docs/basic/frame1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rasql/tk-tutorial/e7a7697afc7fa975a4608c6305edd5bff03bfe9d/docs/basic/frame1.png -------------------------------------------------------------------------------- /docs/basic/frame1.py: -------------------------------------------------------------------------------- 1 | """Embedded frames.""" 2 | from tklib import * 3 | 4 | class Demo(App): 5 | def __init__(self): 6 | super().__init__() 7 | Label('Embedded frames', font='Arial 24') 8 | 9 | types = ['flat', 'raised', 'sunken', 'solid', 'ridge', 'groove'] 10 | for t in types: 11 | Frame(relief=t, padding=(50, 5), borderwidth=5) 12 | Label(t) 13 | 14 | Demo().run() -------------------------------------------------------------------------------- /docs/basic/frame2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rasql/tk-tutorial/e7a7697afc7fa975a4608c6305edd5bff03bfe9d/docs/basic/frame2.png -------------------------------------------------------------------------------- /docs/basic/frame2.py: -------------------------------------------------------------------------------- 1 | """Speparate frames.""" 2 | from tklib import * 3 | 4 | class Demo(App): 5 | def __init__(self, **kwargs): 6 | super().__init__(**kwargs) 7 | 8 | Label('Embedded frames', font='Arial 24') 9 | 10 | Frame() 11 | Button() 12 | Entry() 13 | 14 | Frame() 15 | Button() 16 | Entry() 17 | 18 | App.stack.pop() 19 | App.stack.pop() 20 | Button() 21 | Frame() 22 | Button() 23 | Entry() 24 | 25 | 26 | 27 | if __name__ == '__main__': 28 | Demo().run() -------------------------------------------------------------------------------- /docs/basic/icons/address-book-alt.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rasql/tk-tutorial/e7a7697afc7fa975a4608c6305edd5bff03bfe9d/docs/basic/icons/address-book-alt.png -------------------------------------------------------------------------------- /docs/basic/icons/address-book.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rasql/tk-tutorial/e7a7697afc7fa975a4608c6305edd5bff03bfe9d/docs/basic/icons/address-book.png -------------------------------------------------------------------------------- /docs/basic/icons/bag.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rasql/tk-tutorial/e7a7697afc7fa975a4608c6305edd5bff03bfe9d/docs/basic/icons/bag.png -------------------------------------------------------------------------------- /docs/basic/icons/basket.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rasql/tk-tutorial/e7a7697afc7fa975a4608c6305edd5bff03bfe9d/docs/basic/icons/basket.png -------------------------------------------------------------------------------- /docs/basic/icons/beer.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rasql/tk-tutorial/e7a7697afc7fa975a4608c6305edd5bff03bfe9d/docs/basic/icons/beer.png -------------------------------------------------------------------------------- /docs/basic/icons/bell.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rasql/tk-tutorial/e7a7697afc7fa975a4608c6305edd5bff03bfe9d/docs/basic/icons/bell.png -------------------------------------------------------------------------------- /docs/basic/icons/bitcoin.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rasql/tk-tutorial/e7a7697afc7fa975a4608c6305edd5bff03bfe9d/docs/basic/icons/bitcoin.png -------------------------------------------------------------------------------- /docs/basic/icons/book-bookmark.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rasql/tk-tutorial/e7a7697afc7fa975a4608c6305edd5bff03bfe9d/docs/basic/icons/book-bookmark.png -------------------------------------------------------------------------------- /docs/basic/icons/book.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rasql/tk-tutorial/e7a7697afc7fa975a4608c6305edd5bff03bfe9d/docs/basic/icons/book.png -------------------------------------------------------------------------------- /docs/basic/icons/box-full.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rasql/tk-tutorial/e7a7697afc7fa975a4608c6305edd5bff03bfe9d/docs/basic/icons/box-full.png -------------------------------------------------------------------------------- /docs/basic/icons/box-in.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rasql/tk-tutorial/e7a7697afc7fa975a4608c6305edd5bff03bfe9d/docs/basic/icons/box-in.png -------------------------------------------------------------------------------- /docs/basic/icons/box-out.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rasql/tk-tutorial/e7a7697afc7fa975a4608c6305edd5bff03bfe9d/docs/basic/icons/box-out.png -------------------------------------------------------------------------------- /docs/basic/icons/box.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rasql/tk-tutorial/e7a7697afc7fa975a4608c6305edd5bff03bfe9d/docs/basic/icons/box.png -------------------------------------------------------------------------------- /docs/basic/icons/brick-alt.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rasql/tk-tutorial/e7a7697afc7fa975a4608c6305edd5bff03bfe9d/docs/basic/icons/brick-alt.png -------------------------------------------------------------------------------- /docs/basic/icons/brick.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rasql/tk-tutorial/e7a7697afc7fa975a4608c6305edd5bff03bfe9d/docs/basic/icons/brick.png -------------------------------------------------------------------------------- /docs/basic/icons/bubble.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rasql/tk-tutorial/e7a7697afc7fa975a4608c6305edd5bff03bfe9d/docs/basic/icons/bubble.png -------------------------------------------------------------------------------- /docs/basic/icons/bubbles-alt.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rasql/tk-tutorial/e7a7697afc7fa975a4608c6305edd5bff03bfe9d/docs/basic/icons/bubbles-alt.png -------------------------------------------------------------------------------- /docs/basic/icons/bubbles.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rasql/tk-tutorial/e7a7697afc7fa975a4608c6305edd5bff03bfe9d/docs/basic/icons/bubbles.png -------------------------------------------------------------------------------- /docs/basic/icons/building.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rasql/tk-tutorial/e7a7697afc7fa975a4608c6305edd5bff03bfe9d/docs/basic/icons/building.png -------------------------------------------------------------------------------- /docs/basic/icons/bullhorn.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rasql/tk-tutorial/e7a7697afc7fa975a4608c6305edd5bff03bfe9d/docs/basic/icons/bullhorn.png -------------------------------------------------------------------------------- /docs/basic/icons/calculator.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rasql/tk-tutorial/e7a7697afc7fa975a4608c6305edd5bff03bfe9d/docs/basic/icons/calculator.png -------------------------------------------------------------------------------- /docs/basic/icons/calendar-clock.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rasql/tk-tutorial/e7a7697afc7fa975a4608c6305edd5bff03bfe9d/docs/basic/icons/calendar-clock.png -------------------------------------------------------------------------------- /docs/basic/icons/calendar.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rasql/tk-tutorial/e7a7697afc7fa975a4608c6305edd5bff03bfe9d/docs/basic/icons/calendar.png -------------------------------------------------------------------------------- /docs/basic/icons/carton.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rasql/tk-tutorial/e7a7697afc7fa975a4608c6305edd5bff03bfe9d/docs/basic/icons/carton.png -------------------------------------------------------------------------------- /docs/basic/icons/cat.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rasql/tk-tutorial/e7a7697afc7fa975a4608c6305edd5bff03bfe9d/docs/basic/icons/cat.png -------------------------------------------------------------------------------- /docs/basic/icons/clock.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rasql/tk-tutorial/e7a7697afc7fa975a4608c6305edd5bff03bfe9d/docs/basic/icons/clock.png -------------------------------------------------------------------------------- /docs/basic/icons/cloud-down.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rasql/tk-tutorial/e7a7697afc7fa975a4608c6305edd5bff03bfe9d/docs/basic/icons/cloud-down.png -------------------------------------------------------------------------------- /docs/basic/icons/cloud-sync.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rasql/tk-tutorial/e7a7697afc7fa975a4608c6305edd5bff03bfe9d/docs/basic/icons/cloud-sync.png -------------------------------------------------------------------------------- /docs/basic/icons/cloud-up.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rasql/tk-tutorial/e7a7697afc7fa975a4608c6305edd5bff03bfe9d/docs/basic/icons/cloud-up.png -------------------------------------------------------------------------------- /docs/basic/icons/cloud.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rasql/tk-tutorial/e7a7697afc7fa975a4608c6305edd5bff03bfe9d/docs/basic/icons/cloud.png -------------------------------------------------------------------------------- /docs/basic/icons/cog.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rasql/tk-tutorial/e7a7697afc7fa975a4608c6305edd5bff03bfe9d/docs/basic/icons/cog.png -------------------------------------------------------------------------------- /docs/basic/icons/cogs.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rasql/tk-tutorial/e7a7697afc7fa975a4608c6305edd5bff03bfe9d/docs/basic/icons/cogs.png -------------------------------------------------------------------------------- /docs/basic/icons/compass.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rasql/tk-tutorial/e7a7697afc7fa975a4608c6305edd5bff03bfe9d/docs/basic/icons/compass.png -------------------------------------------------------------------------------- /docs/basic/icons/cone.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rasql/tk-tutorial/e7a7697afc7fa975a4608c6305edd5bff03bfe9d/docs/basic/icons/cone.png -------------------------------------------------------------------------------- /docs/basic/icons/dashboard-alt.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rasql/tk-tutorial/e7a7697afc7fa975a4608c6305edd5bff03bfe9d/docs/basic/icons/dashboard-alt.png -------------------------------------------------------------------------------- /docs/basic/icons/dashboard.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rasql/tk-tutorial/e7a7697afc7fa975a4608c6305edd5bff03bfe9d/docs/basic/icons/dashboard.png -------------------------------------------------------------------------------- /docs/basic/icons/database.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rasql/tk-tutorial/e7a7697afc7fa975a4608c6305edd5bff03bfe9d/docs/basic/icons/database.png -------------------------------------------------------------------------------- /docs/basic/icons/device-camera.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rasql/tk-tutorial/e7a7697afc7fa975a4608c6305edd5bff03bfe9d/docs/basic/icons/device-camera.png -------------------------------------------------------------------------------- /docs/basic/icons/device-computer.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rasql/tk-tutorial/e7a7697afc7fa975a4608c6305edd5bff03bfe9d/docs/basic/icons/device-computer.png -------------------------------------------------------------------------------- /docs/basic/icons/device-drive.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rasql/tk-tutorial/e7a7697afc7fa975a4608c6305edd5bff03bfe9d/docs/basic/icons/device-drive.png -------------------------------------------------------------------------------- /docs/basic/icons/device-laptop.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rasql/tk-tutorial/e7a7697afc7fa975a4608c6305edd5bff03bfe9d/docs/basic/icons/device-laptop.png -------------------------------------------------------------------------------- /docs/basic/icons/device-mobile-phone.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rasql/tk-tutorial/e7a7697afc7fa975a4608c6305edd5bff03bfe9d/docs/basic/icons/device-mobile-phone.png -------------------------------------------------------------------------------- /docs/basic/icons/device-tablet.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rasql/tk-tutorial/e7a7697afc7fa975a4608c6305edd5bff03bfe9d/docs/basic/icons/device-tablet.png -------------------------------------------------------------------------------- /docs/basic/icons/device-tv.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rasql/tk-tutorial/e7a7697afc7fa975a4608c6305edd5bff03bfe9d/docs/basic/icons/device-tv.png -------------------------------------------------------------------------------- /docs/basic/icons/disc-vinyl.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rasql/tk-tutorial/e7a7697afc7fa975a4608c6305edd5bff03bfe9d/docs/basic/icons/disc-vinyl.png -------------------------------------------------------------------------------- /docs/basic/icons/disc.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rasql/tk-tutorial/e7a7697afc7fa975a4608c6305edd5bff03bfe9d/docs/basic/icons/disc.png -------------------------------------------------------------------------------- /docs/basic/icons/drop.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rasql/tk-tutorial/e7a7697afc7fa975a4608c6305edd5bff03bfe9d/docs/basic/icons/drop.png -------------------------------------------------------------------------------- /docs/basic/icons/envelope-letter.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rasql/tk-tutorial/e7a7697afc7fa975a4608c6305edd5bff03bfe9d/docs/basic/icons/envelope-letter.png -------------------------------------------------------------------------------- /docs/basic/icons/envelope.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rasql/tk-tutorial/e7a7697afc7fa975a4608c6305edd5bff03bfe9d/docs/basic/icons/envelope.png -------------------------------------------------------------------------------- /docs/basic/icons/file-bookmark.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rasql/tk-tutorial/e7a7697afc7fa975a4608c6305edd5bff03bfe9d/docs/basic/icons/file-bookmark.png -------------------------------------------------------------------------------- /docs/basic/icons/file-code.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rasql/tk-tutorial/e7a7697afc7fa975a4608c6305edd5bff03bfe9d/docs/basic/icons/file-code.png -------------------------------------------------------------------------------- /docs/basic/icons/file-empty.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rasql/tk-tutorial/e7a7697afc7fa975a4608c6305edd5bff03bfe9d/docs/basic/icons/file-empty.png -------------------------------------------------------------------------------- /docs/basic/icons/file-excel.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rasql/tk-tutorial/e7a7697afc7fa975a4608c6305edd5bff03bfe9d/docs/basic/icons/file-excel.png -------------------------------------------------------------------------------- /docs/basic/icons/file-exe.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rasql/tk-tutorial/e7a7697afc7fa975a4608c6305edd5bff03bfe9d/docs/basic/icons/file-exe.png -------------------------------------------------------------------------------- /docs/basic/icons/file-font.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rasql/tk-tutorial/e7a7697afc7fa975a4608c6305edd5bff03bfe9d/docs/basic/icons/file-font.png -------------------------------------------------------------------------------- /docs/basic/icons/file-illustrator.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rasql/tk-tutorial/e7a7697afc7fa975a4608c6305edd5bff03bfe9d/docs/basic/icons/file-illustrator.png -------------------------------------------------------------------------------- /docs/basic/icons/file-indesign.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rasql/tk-tutorial/e7a7697afc7fa975a4608c6305edd5bff03bfe9d/docs/basic/icons/file-indesign.png -------------------------------------------------------------------------------- /docs/basic/icons/file-link.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rasql/tk-tutorial/e7a7697afc7fa975a4608c6305edd5bff03bfe9d/docs/basic/icons/file-link.png -------------------------------------------------------------------------------- /docs/basic/icons/file-note.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rasql/tk-tutorial/e7a7697afc7fa975a4608c6305edd5bff03bfe9d/docs/basic/icons/file-note.png -------------------------------------------------------------------------------- /docs/basic/icons/file-pdf.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rasql/tk-tutorial/e7a7697afc7fa975a4608c6305edd5bff03bfe9d/docs/basic/icons/file-pdf.png -------------------------------------------------------------------------------- /docs/basic/icons/file-photoshop.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rasql/tk-tutorial/e7a7697afc7fa975a4608c6305edd5bff03bfe9d/docs/basic/icons/file-photoshop.png -------------------------------------------------------------------------------- /docs/basic/icons/file-picture.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rasql/tk-tutorial/e7a7697afc7fa975a4608c6305edd5bff03bfe9d/docs/basic/icons/file-picture.png -------------------------------------------------------------------------------- /docs/basic/icons/file-powerpoint.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rasql/tk-tutorial/e7a7697afc7fa975a4608c6305edd5bff03bfe9d/docs/basic/icons/file-powerpoint.png -------------------------------------------------------------------------------- /docs/basic/icons/file-premiere.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rasql/tk-tutorial/e7a7697afc7fa975a4608c6305edd5bff03bfe9d/docs/basic/icons/file-premiere.png -------------------------------------------------------------------------------- /docs/basic/icons/file-sound.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rasql/tk-tutorial/e7a7697afc7fa975a4608c6305edd5bff03bfe9d/docs/basic/icons/file-sound.png -------------------------------------------------------------------------------- /docs/basic/icons/file-text.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rasql/tk-tutorial/e7a7697afc7fa975a4608c6305edd5bff03bfe9d/docs/basic/icons/file-text.png -------------------------------------------------------------------------------- /docs/basic/icons/file-video.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rasql/tk-tutorial/e7a7697afc7fa975a4608c6305edd5bff03bfe9d/docs/basic/icons/file-video.png -------------------------------------------------------------------------------- /docs/basic/icons/file-word.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rasql/tk-tutorial/e7a7697afc7fa975a4608c6305edd5bff03bfe9d/docs/basic/icons/file-word.png -------------------------------------------------------------------------------- /docs/basic/icons/file-zip.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rasql/tk-tutorial/e7a7697afc7fa975a4608c6305edd5bff03bfe9d/docs/basic/icons/file-zip.png -------------------------------------------------------------------------------- /docs/basic/icons/flag-alt.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rasql/tk-tutorial/e7a7697afc7fa975a4608c6305edd5bff03bfe9d/docs/basic/icons/flag-alt.png -------------------------------------------------------------------------------- /docs/basic/icons/flag.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rasql/tk-tutorial/e7a7697afc7fa975a4608c6305edd5bff03bfe9d/docs/basic/icons/flag.png -------------------------------------------------------------------------------- /docs/basic/icons/flask.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rasql/tk-tutorial/e7a7697afc7fa975a4608c6305edd5bff03bfe9d/docs/basic/icons/flask.png -------------------------------------------------------------------------------- /docs/basic/icons/floppy.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rasql/tk-tutorial/e7a7697afc7fa975a4608c6305edd5bff03bfe9d/docs/basic/icons/floppy.png -------------------------------------------------------------------------------- /docs/basic/icons/flower.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rasql/tk-tutorial/e7a7697afc7fa975a4608c6305edd5bff03bfe9d/docs/basic/icons/flower.png -------------------------------------------------------------------------------- /docs/basic/icons/folder-document.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rasql/tk-tutorial/e7a7697afc7fa975a4608c6305edd5bff03bfe9d/docs/basic/icons/folder-document.png -------------------------------------------------------------------------------- /docs/basic/icons/folder-house.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rasql/tk-tutorial/e7a7697afc7fa975a4608c6305edd5bff03bfe9d/docs/basic/icons/folder-house.png -------------------------------------------------------------------------------- /docs/basic/icons/folder-music.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rasql/tk-tutorial/e7a7697afc7fa975a4608c6305edd5bff03bfe9d/docs/basic/icons/folder-music.png -------------------------------------------------------------------------------- /docs/basic/icons/folder-picture.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rasql/tk-tutorial/e7a7697afc7fa975a4608c6305edd5bff03bfe9d/docs/basic/icons/folder-picture.png -------------------------------------------------------------------------------- /docs/basic/icons/folder-video.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rasql/tk-tutorial/e7a7697afc7fa975a4608c6305edd5bff03bfe9d/docs/basic/icons/folder-video.png -------------------------------------------------------------------------------- /docs/basic/icons/folder.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rasql/tk-tutorial/e7a7697afc7fa975a4608c6305edd5bff03bfe9d/docs/basic/icons/folder.png -------------------------------------------------------------------------------- /docs/basic/icons/funnel.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rasql/tk-tutorial/e7a7697afc7fa975a4608c6305edd5bff03bfe9d/docs/basic/icons/funnel.png -------------------------------------------------------------------------------- /docs/basic/icons/gamepad.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rasql/tk-tutorial/e7a7697afc7fa975a4608c6305edd5bff03bfe9d/docs/basic/icons/gamepad.png -------------------------------------------------------------------------------- /docs/basic/icons/gift.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rasql/tk-tutorial/e7a7697afc7fa975a4608c6305edd5bff03bfe9d/docs/basic/icons/gift.png -------------------------------------------------------------------------------- /docs/basic/icons/globe.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rasql/tk-tutorial/e7a7697afc7fa975a4608c6305edd5bff03bfe9d/docs/basic/icons/globe.png -------------------------------------------------------------------------------- /docs/basic/icons/handshake.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rasql/tk-tutorial/e7a7697afc7fa975a4608c6305edd5bff03bfe9d/docs/basic/icons/handshake.png -------------------------------------------------------------------------------- /docs/basic/icons/headphone.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rasql/tk-tutorial/e7a7697afc7fa975a4608c6305edd5bff03bfe9d/docs/basic/icons/headphone.png -------------------------------------------------------------------------------- /docs/basic/icons/heart.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rasql/tk-tutorial/e7a7697afc7fa975a4608c6305edd5bff03bfe9d/docs/basic/icons/heart.png -------------------------------------------------------------------------------- /docs/basic/icons/house.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rasql/tk-tutorial/e7a7697afc7fa975a4608c6305edd5bff03bfe9d/docs/basic/icons/house.png -------------------------------------------------------------------------------- /docs/basic/icons/institution.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rasql/tk-tutorial/e7a7697afc7fa975a4608c6305edd5bff03bfe9d/docs/basic/icons/institution.png -------------------------------------------------------------------------------- /docs/basic/icons/key.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rasql/tk-tutorial/e7a7697afc7fa975a4608c6305edd5bff03bfe9d/docs/basic/icons/key.png -------------------------------------------------------------------------------- /docs/basic/icons/keyring.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rasql/tk-tutorial/e7a7697afc7fa975a4608c6305edd5bff03bfe9d/docs/basic/icons/keyring.png -------------------------------------------------------------------------------- /docs/basic/icons/layers.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rasql/tk-tutorial/e7a7697afc7fa975a4608c6305edd5bff03bfe9d/docs/basic/icons/layers.png -------------------------------------------------------------------------------- /docs/basic/icons/life-buoy.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rasql/tk-tutorial/e7a7697afc7fa975a4608c6305edd5bff03bfe9d/docs/basic/icons/life-buoy.png -------------------------------------------------------------------------------- /docs/basic/icons/light-bulb.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rasql/tk-tutorial/e7a7697afc7fa975a4608c6305edd5bff03bfe9d/docs/basic/icons/light-bulb.png -------------------------------------------------------------------------------- /docs/basic/icons/lightning.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rasql/tk-tutorial/e7a7697afc7fa975a4608c6305edd5bff03bfe9d/docs/basic/icons/lightning.png -------------------------------------------------------------------------------- /docs/basic/icons/lock-open.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rasql/tk-tutorial/e7a7697afc7fa975a4608c6305edd5bff03bfe9d/docs/basic/icons/lock-open.png -------------------------------------------------------------------------------- /docs/basic/icons/lock.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rasql/tk-tutorial/e7a7697afc7fa975a4608c6305edd5bff03bfe9d/docs/basic/icons/lock.png -------------------------------------------------------------------------------- /docs/basic/icons/magnify-less.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rasql/tk-tutorial/e7a7697afc7fa975a4608c6305edd5bff03bfe9d/docs/basic/icons/magnify-less.png -------------------------------------------------------------------------------- /docs/basic/icons/magnify.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rasql/tk-tutorial/e7a7697afc7fa975a4608c6305edd5bff03bfe9d/docs/basic/icons/magnify.png -------------------------------------------------------------------------------- /docs/basic/icons/map-map-marker.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rasql/tk-tutorial/e7a7697afc7fa975a4608c6305edd5bff03bfe9d/docs/basic/icons/map-map-marker.png -------------------------------------------------------------------------------- /docs/basic/icons/map-marker.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rasql/tk-tutorial/e7a7697afc7fa975a4608c6305edd5bff03bfe9d/docs/basic/icons/map-marker.png -------------------------------------------------------------------------------- /docs/basic/icons/map.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rasql/tk-tutorial/e7a7697afc7fa975a4608c6305edd5bff03bfe9d/docs/basic/icons/map.png -------------------------------------------------------------------------------- /docs/basic/icons/microphone.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rasql/tk-tutorial/e7a7697afc7fa975a4608c6305edd5bff03bfe9d/docs/basic/icons/microphone.png -------------------------------------------------------------------------------- /docs/basic/icons/mixer.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rasql/tk-tutorial/e7a7697afc7fa975a4608c6305edd5bff03bfe9d/docs/basic/icons/mixer.png -------------------------------------------------------------------------------- /docs/basic/icons/money.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rasql/tk-tutorial/e7a7697afc7fa975a4608c6305edd5bff03bfe9d/docs/basic/icons/money.png -------------------------------------------------------------------------------- /docs/basic/icons/monitor.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rasql/tk-tutorial/e7a7697afc7fa975a4608c6305edd5bff03bfe9d/docs/basic/icons/monitor.png -------------------------------------------------------------------------------- /docs/basic/icons/news.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rasql/tk-tutorial/e7a7697afc7fa975a4608c6305edd5bff03bfe9d/docs/basic/icons/news.png -------------------------------------------------------------------------------- /docs/basic/icons/notepad.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rasql/tk-tutorial/e7a7697afc7fa975a4608c6305edd5bff03bfe9d/docs/basic/icons/notepad.png -------------------------------------------------------------------------------- /docs/basic/icons/paper-plane.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rasql/tk-tutorial/e7a7697afc7fa975a4608c6305edd5bff03bfe9d/docs/basic/icons/paper-plane.png -------------------------------------------------------------------------------- /docs/basic/icons/paperclip.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rasql/tk-tutorial/e7a7697afc7fa975a4608c6305edd5bff03bfe9d/docs/basic/icons/paperclip.png -------------------------------------------------------------------------------- /docs/basic/icons/pencil.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rasql/tk-tutorial/e7a7697afc7fa975a4608c6305edd5bff03bfe9d/docs/basic/icons/pencil.png -------------------------------------------------------------------------------- /docs/basic/icons/phone.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rasql/tk-tutorial/e7a7697afc7fa975a4608c6305edd5bff03bfe9d/docs/basic/icons/phone.png -------------------------------------------------------------------------------- /docs/basic/icons/pin.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rasql/tk-tutorial/e7a7697afc7fa975a4608c6305edd5bff03bfe9d/docs/basic/icons/pin.png -------------------------------------------------------------------------------- /docs/basic/icons/post-it.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rasql/tk-tutorial/e7a7697afc7fa975a4608c6305edd5bff03bfe9d/docs/basic/icons/post-it.png -------------------------------------------------------------------------------- /docs/basic/icons/profile-group.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rasql/tk-tutorial/e7a7697afc7fa975a4608c6305edd5bff03bfe9d/docs/basic/icons/profile-group.png -------------------------------------------------------------------------------- /docs/basic/icons/profile.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rasql/tk-tutorial/e7a7697afc7fa975a4608c6305edd5bff03bfe9d/docs/basic/icons/profile.png -------------------------------------------------------------------------------- /docs/basic/icons/puzzle.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rasql/tk-tutorial/e7a7697afc7fa975a4608c6305edd5bff03bfe9d/docs/basic/icons/puzzle.png -------------------------------------------------------------------------------- /docs/basic/icons/radio.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rasql/tk-tutorial/e7a7697afc7fa975a4608c6305edd5bff03bfe9d/docs/basic/icons/radio.png -------------------------------------------------------------------------------- /docs/basic/icons/rss.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rasql/tk-tutorial/e7a7697afc7fa975a4608c6305edd5bff03bfe9d/docs/basic/icons/rss.png -------------------------------------------------------------------------------- /docs/basic/icons/safe.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rasql/tk-tutorial/e7a7697afc7fa975a4608c6305edd5bff03bfe9d/docs/basic/icons/safe.png -------------------------------------------------------------------------------- /docs/basic/icons/search.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rasql/tk-tutorial/e7a7697afc7fa975a4608c6305edd5bff03bfe9d/docs/basic/icons/search.png -------------------------------------------------------------------------------- /docs/basic/icons/shield-error.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rasql/tk-tutorial/e7a7697afc7fa975a4608c6305edd5bff03bfe9d/docs/basic/icons/shield-error.png -------------------------------------------------------------------------------- /docs/basic/icons/shield-ok.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rasql/tk-tutorial/e7a7697afc7fa975a4608c6305edd5bff03bfe9d/docs/basic/icons/shield-ok.png -------------------------------------------------------------------------------- /docs/basic/icons/shield-warning.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rasql/tk-tutorial/e7a7697afc7fa975a4608c6305edd5bff03bfe9d/docs/basic/icons/shield-warning.png -------------------------------------------------------------------------------- /docs/basic/icons/shield.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rasql/tk-tutorial/e7a7697afc7fa975a4608c6305edd5bff03bfe9d/docs/basic/icons/shield.png -------------------------------------------------------------------------------- /docs/basic/icons/shop.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rasql/tk-tutorial/e7a7697afc7fa975a4608c6305edd5bff03bfe9d/docs/basic/icons/shop.png -------------------------------------------------------------------------------- /docs/basic/icons/sign-add.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rasql/tk-tutorial/e7a7697afc7fa975a4608c6305edd5bff03bfe9d/docs/basic/icons/sign-add.png -------------------------------------------------------------------------------- /docs/basic/icons/sign-ban.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rasql/tk-tutorial/e7a7697afc7fa975a4608c6305edd5bff03bfe9d/docs/basic/icons/sign-ban.png -------------------------------------------------------------------------------- /docs/basic/icons/sign-check.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rasql/tk-tutorial/e7a7697afc7fa975a4608c6305edd5bff03bfe9d/docs/basic/icons/sign-check.png -------------------------------------------------------------------------------- /docs/basic/icons/sign-delete.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rasql/tk-tutorial/e7a7697afc7fa975a4608c6305edd5bff03bfe9d/docs/basic/icons/sign-delete.png -------------------------------------------------------------------------------- /docs/basic/icons/sign-down.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rasql/tk-tutorial/e7a7697afc7fa975a4608c6305edd5bff03bfe9d/docs/basic/icons/sign-down.png -------------------------------------------------------------------------------- /docs/basic/icons/sign-error.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rasql/tk-tutorial/e7a7697afc7fa975a4608c6305edd5bff03bfe9d/docs/basic/icons/sign-error.png -------------------------------------------------------------------------------- /docs/basic/icons/sign-info.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rasql/tk-tutorial/e7a7697afc7fa975a4608c6305edd5bff03bfe9d/docs/basic/icons/sign-info.png -------------------------------------------------------------------------------- /docs/basic/icons/sign-left.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rasql/tk-tutorial/e7a7697afc7fa975a4608c6305edd5bff03bfe9d/docs/basic/icons/sign-left.png -------------------------------------------------------------------------------- /docs/basic/icons/sign-question.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rasql/tk-tutorial/e7a7697afc7fa975a4608c6305edd5bff03bfe9d/docs/basic/icons/sign-question.png -------------------------------------------------------------------------------- /docs/basic/icons/sign-right.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rasql/tk-tutorial/e7a7697afc7fa975a4608c6305edd5bff03bfe9d/docs/basic/icons/sign-right.png -------------------------------------------------------------------------------- /docs/basic/icons/sign-sync.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rasql/tk-tutorial/e7a7697afc7fa975a4608c6305edd5bff03bfe9d/docs/basic/icons/sign-sync.png -------------------------------------------------------------------------------- /docs/basic/icons/sign-up.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rasql/tk-tutorial/e7a7697afc7fa975a4608c6305edd5bff03bfe9d/docs/basic/icons/sign-up.png -------------------------------------------------------------------------------- /docs/basic/icons/sign-warning.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rasql/tk-tutorial/e7a7697afc7fa975a4608c6305edd5bff03bfe9d/docs/basic/icons/sign-warning.png -------------------------------------------------------------------------------- /docs/basic/icons/skull.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rasql/tk-tutorial/e7a7697afc7fa975a4608c6305edd5bff03bfe9d/docs/basic/icons/skull.png -------------------------------------------------------------------------------- /docs/basic/icons/snow-flake.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rasql/tk-tutorial/e7a7697afc7fa975a4608c6305edd5bff03bfe9d/docs/basic/icons/snow-flake.png -------------------------------------------------------------------------------- /docs/basic/icons/social-facebook.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rasql/tk-tutorial/e7a7697afc7fa975a4608c6305edd5bff03bfe9d/docs/basic/icons/social-facebook.png -------------------------------------------------------------------------------- /docs/basic/icons/social-google-plus.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rasql/tk-tutorial/e7a7697afc7fa975a4608c6305edd5bff03bfe9d/docs/basic/icons/social-google-plus.png -------------------------------------------------------------------------------- /docs/basic/icons/social-twitter.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rasql/tk-tutorial/e7a7697afc7fa975a4608c6305edd5bff03bfe9d/docs/basic/icons/social-twitter.png -------------------------------------------------------------------------------- /docs/basic/icons/social-youtube.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rasql/tk-tutorial/e7a7697afc7fa975a4608c6305edd5bff03bfe9d/docs/basic/icons/social-youtube.png -------------------------------------------------------------------------------- /docs/basic/icons/stamp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rasql/tk-tutorial/e7a7697afc7fa975a4608c6305edd5bff03bfe9d/docs/basic/icons/stamp.png -------------------------------------------------------------------------------- /docs/basic/icons/star-alt.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rasql/tk-tutorial/e7a7697afc7fa975a4608c6305edd5bff03bfe9d/docs/basic/icons/star-alt.png -------------------------------------------------------------------------------- /docs/basic/icons/star.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rasql/tk-tutorial/e7a7697afc7fa975a4608c6305edd5bff03bfe9d/docs/basic/icons/star.png -------------------------------------------------------------------------------- /docs/basic/icons/sun.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rasql/tk-tutorial/e7a7697afc7fa975a4608c6305edd5bff03bfe9d/docs/basic/icons/sun.png -------------------------------------------------------------------------------- /docs/basic/icons/switch-off.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rasql/tk-tutorial/e7a7697afc7fa975a4608c6305edd5bff03bfe9d/docs/basic/icons/switch-off.png -------------------------------------------------------------------------------- /docs/basic/icons/switch-on.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rasql/tk-tutorial/e7a7697afc7fa975a4608c6305edd5bff03bfe9d/docs/basic/icons/switch-on.png -------------------------------------------------------------------------------- /docs/basic/icons/tag-alt.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rasql/tk-tutorial/e7a7697afc7fa975a4608c6305edd5bff03bfe9d/docs/basic/icons/tag-alt.png -------------------------------------------------------------------------------- /docs/basic/icons/tag.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rasql/tk-tutorial/e7a7697afc7fa975a4608c6305edd5bff03bfe9d/docs/basic/icons/tag.png -------------------------------------------------------------------------------- /docs/basic/icons/terminal.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rasql/tk-tutorial/e7a7697afc7fa975a4608c6305edd5bff03bfe9d/docs/basic/icons/terminal.png -------------------------------------------------------------------------------- /docs/basic/icons/thumb-up.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rasql/tk-tutorial/e7a7697afc7fa975a4608c6305edd5bff03bfe9d/docs/basic/icons/thumb-up.png -------------------------------------------------------------------------------- /docs/basic/icons/trashcan-full.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rasql/tk-tutorial/e7a7697afc7fa975a4608c6305edd5bff03bfe9d/docs/basic/icons/trashcan-full.png -------------------------------------------------------------------------------- /docs/basic/icons/trashcan.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rasql/tk-tutorial/e7a7697afc7fa975a4608c6305edd5bff03bfe9d/docs/basic/icons/trashcan.png -------------------------------------------------------------------------------- /docs/basic/icons/user-female-alt.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rasql/tk-tutorial/e7a7697afc7fa975a4608c6305edd5bff03bfe9d/docs/basic/icons/user-female-alt.png -------------------------------------------------------------------------------- /docs/basic/icons/user-female.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rasql/tk-tutorial/e7a7697afc7fa975a4608c6305edd5bff03bfe9d/docs/basic/icons/user-female.png -------------------------------------------------------------------------------- /docs/basic/icons/user-id.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rasql/tk-tutorial/e7a7697afc7fa975a4608c6305edd5bff03bfe9d/docs/basic/icons/user-id.png -------------------------------------------------------------------------------- /docs/basic/icons/user-male-alt.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rasql/tk-tutorial/e7a7697afc7fa975a4608c6305edd5bff03bfe9d/docs/basic/icons/user-male-alt.png -------------------------------------------------------------------------------- /docs/basic/icons/user-male.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rasql/tk-tutorial/e7a7697afc7fa975a4608c6305edd5bff03bfe9d/docs/basic/icons/user-male.png -------------------------------------------------------------------------------- /docs/basic/icons/webcam.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rasql/tk-tutorial/e7a7697afc7fa975a4608c6305edd5bff03bfe9d/docs/basic/icons/webcam.png -------------------------------------------------------------------------------- /docs/basic/icons/window-layout.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rasql/tk-tutorial/e7a7697afc7fa975a4608c6305edd5bff03bfe9d/docs/basic/icons/window-layout.png -------------------------------------------------------------------------------- /docs/basic/icons/window-system.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rasql/tk-tutorial/e7a7697afc7fa975a4608c6305edd5bff03bfe9d/docs/basic/icons/window-system.png -------------------------------------------------------------------------------- /docs/basic/icons/window.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rasql/tk-tutorial/e7a7697afc7fa975a4608c6305edd5bff03bfe9d/docs/basic/icons/window.png -------------------------------------------------------------------------------- /docs/basic/icons/wine.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rasql/tk-tutorial/e7a7697afc7fa975a4608c6305edd5bff03bfe9d/docs/basic/icons/wine.png -------------------------------------------------------------------------------- /docs/basic/icons/wrench-screwdriver.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rasql/tk-tutorial/e7a7697afc7fa975a4608c6305edd5bff03bfe9d/docs/basic/icons/wrench-screwdriver.png -------------------------------------------------------------------------------- /docs/basic/icons/wrench.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rasql/tk-tutorial/e7a7697afc7fa975a4608c6305edd5bff03bfe9d/docs/basic/icons/wrench.png -------------------------------------------------------------------------------- /docs/basic/label1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rasql/tk-tutorial/e7a7697afc7fa975a4608c6305edd5bff03bfe9d/docs/basic/label1.png -------------------------------------------------------------------------------- /docs/basic/label1.py: -------------------------------------------------------------------------------- 1 | """Display a label with an image.""" 2 | 3 | import os 4 | from tklib import * 5 | from PIL import Image, ImageTk 6 | 7 | class Demo(App): 8 | def __init__(self, **kwargs): 9 | super().__init__(**kwargs) 10 | Label('Show images', font='Arial 24') 11 | 12 | lb = Label() 13 | App.img0 = Image.open('icons/bell.png') 14 | App.img = ImageTk.PhotoImage(App.img0) 15 | lb['image'] = App.img 16 | 17 | L = 'text;image;center;top;left;bottom;right'.split(';') 18 | 19 | i = 0 20 | for l in L: 21 | lb = Label(l, compound=l, image=App.img, padding=10) 22 | lb.grid(column=i, row=1) 23 | i += 1 24 | 25 | Demo().run() -------------------------------------------------------------------------------- /docs/basic/label2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rasql/tk-tutorial/e7a7697afc7fa975a4608c6305edd5bff03bfe9d/docs/basic/label2.png -------------------------------------------------------------------------------- /docs/basic/label2.py: -------------------------------------------------------------------------------- 1 | """Display images as labels.""" 2 | from tklib import * 3 | from PIL import Image, ImageTk 4 | 5 | class Demo(App): 6 | def __init__(self): 7 | super().__init__() 8 | Label('Show images as labels', font='Arial 24') 9 | 10 | dir = os.listdir('icons') 11 | n, m = 2, 5 12 | self.images = [] 13 | Frame() 14 | for i in range(n): 15 | for j in range(m): 16 | k = m*i + j 17 | label = dir[k] 18 | path = 'icons/' + label 19 | img0 = Image.open(path) 20 | img = ImageTk.PhotoImage(img0) 21 | self.images.append(img) 22 | lb = Label(image=img, text=label, compound='top') 23 | lb.grid(row=i, column=j) 24 | 25 | Demo().run() -------------------------------------------------------------------------------- /docs/basic/label3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rasql/tk-tutorial/e7a7697afc7fa975a4608c6305edd5bff03bfe9d/docs/basic/label3.png -------------------------------------------------------------------------------- /docs/basic/label3.py: -------------------------------------------------------------------------------- 1 | """Display images as buttons.""" 2 | 3 | from tklib import * 4 | from PIL import Image, ImageTk 5 | 6 | class Demo(App): 7 | def __init__(self, **kwargs): 8 | super().__init__(**kwargs) 9 | Label('Show images as buttons', font='Arial 24') 10 | 11 | dir = os.listdir('icons') 12 | n, m = 2, 5 13 | self.images = [] 14 | Frame() 15 | for i in range(n): 16 | for j in range(m): 17 | k = m*i + j 18 | label = dir[k] 19 | path = 'icons/' + label 20 | img0 = Image.open(path) 21 | img = ImageTk.PhotoImage(img0) 22 | self.images.append(img) 23 | lb = Button(image=img, text=label, compound='top') 24 | lb.grid(row=i, column=j) 25 | 26 | if __name__ == '__main__': 27 | Demo().run() -------------------------------------------------------------------------------- /docs/basic/label4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rasql/tk-tutorial/e7a7697afc7fa975a4608c6305edd5bff03bfe9d/docs/basic/label4.png -------------------------------------------------------------------------------- /docs/basic/label4.py: -------------------------------------------------------------------------------- 1 | """Display images as listbox.""" 2 | from tklib import * 3 | from PIL import Image, ImageTk 4 | 5 | class Demo(App): 6 | def __init__(self, **kwargs): 7 | super().__init__(**kwargs) 8 | Label('Show images in a treeview', font='Arial 24') 9 | 10 | dir = os.listdir('icons') 11 | self.tree = Treeview(height=20) 12 | self.images = [] 13 | for file in dir: 14 | path = 'icons/' + file 15 | img0 = Image.open(path) 16 | img = ImageTk.PhotoImage(img0) 17 | self.images.append(img) 18 | self.tree.insert('', 'end', text=file, image=img) 19 | 20 | Demo().run() -------------------------------------------------------------------------------- /docs/basic/style1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rasql/tk-tutorial/e7a7697afc7fa975a4608c6305edd5bff03bfe9d/docs/basic/style1.png -------------------------------------------------------------------------------- /docs/basic/style1.py: -------------------------------------------------------------------------------- 1 | """Using themes and styles.""" 2 | 3 | import tkinter.ttk as ttk 4 | from tklib import * 5 | 6 | class Demo(App): 7 | def __init__(self, **kwargs): 8 | super().__init__(**kwargs) 9 | Label('Select a theme', font='Arial 24') 10 | 11 | s = ttk.Style() 12 | print(s.layout('TButton')) 13 | 14 | themes = s.theme_names() 15 | Combobox('theme:', themes, 'ttk.Style().theme_use(self.item)') 16 | 17 | for t in themes: 18 | s.theme_use(t) 19 | Button(t) 20 | 21 | if __name__ == '__main__': 22 | Demo().run() -------------------------------------------------------------------------------- /docs/basic/style2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rasql/tk-tutorial/e7a7697afc7fa975a4608c6305edd5bff03bfe9d/docs/basic/style2.png -------------------------------------------------------------------------------- /docs/basic/style2.py: -------------------------------------------------------------------------------- 1 | """Using themes and styles.""" 2 | 3 | import tkinter as tk 4 | import tkinter.ttk as ttk 5 | from tklib import * 6 | 7 | class Demo(App): 8 | def __init__(self, **kwargs): 9 | super().__init__(**kwargs) 10 | Label('Style TButton', font='Arial 24') 11 | Label('configure TButton') 12 | 13 | s = ttk.Style() 14 | themes = s.theme_names() 15 | s.configure('TButton', font='Arial 24') 16 | 17 | for t in themes: 18 | Button(t) 19 | 20 | if __name__ == '__main__': 21 | Demo().run() -------------------------------------------------------------------------------- /docs/basic/style3.py: -------------------------------------------------------------------------------- 1 | """Use styles and themes.""" 2 | 3 | import tkinter as tk 4 | import tkinter.ttk as ttk 5 | from tklib import * 6 | 7 | class Demo(App): 8 | def __init__(self): 9 | super().__init__() 10 | Label('Widget style', font='Arial 24') 11 | 12 | Label('widget state') 13 | c = Checkbutton('active;disabled;focus;pressed;selected;' 14 | 'background;readonly;alternate;invalid;hover') 15 | 16 | # tk.Frame(App.stack[-1], width=100, height=100, borderwidth=1, relief='solid').grid() 17 | f = Frame() 18 | f.grid() 19 | b = Button() 20 | l = Label() 21 | e = Entry() 22 | 23 | App.stack.pop() 24 | Button() 25 | 26 | Frame() 27 | Button() 28 | Label() 29 | Entry() 30 | 31 | s = ttk.Style() 32 | 33 | widgets = (f, b, l, e) 34 | for w in widgets: 35 | style = w.winfo_class() 36 | 37 | print(s.element_options('Frame.border')) 38 | # s.configure('TFrame', borderwidth=2, background='red', relief='raised') 39 | s.configure('TButton', font='Courier 24', foreground='red', padding=10) 40 | 41 | if __name__ == '__main__': 42 | Demo().run() -------------------------------------------------------------------------------- /docs/basic/template.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rasql/tk-tutorial/e7a7697afc7fa975a4608c6305edd5bff03bfe9d/docs/basic/template.png -------------------------------------------------------------------------------- /docs/basic/template.py: -------------------------------------------------------------------------------- 1 | """Use this template to start an App.""" 2 | 3 | import tkinter as tk 4 | import tkinter.ttk as ttk 5 | from tklib import * 6 | 7 | class Demo(App): 8 | def __init__(self, **kwargs): 9 | super().__init__(**kwargs) 10 | App.root.title = 'Tk application template' 11 | Label('Demo application', font='Arial 24') 12 | 13 | if __name__ == '__main__': 14 | Demo().run() -------------------------------------------------------------------------------- /docs/basic/tklib.py: -------------------------------------------------------------------------------- 1 | ../../tklib.py -------------------------------------------------------------------------------- /docs/button/bind1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rasql/tk-tutorial/e7a7697afc7fa975a4608c6305edd5bff03bfe9d/docs/button/bind1.png -------------------------------------------------------------------------------- /docs/button/bind1.py: -------------------------------------------------------------------------------- 1 | import tkinter as tk 2 | 3 | root = tk.Tk() 4 | label = tk.Label(root, text='starting...', font='Arial 36') 5 | label.pack() 6 | 7 | label.bind('', lambda e: l.configure(text='mouse inside')) 8 | label.bind('', lambda e: l.configure(text='mouse outside')) 9 | label.bind('<1>', lambda e: l.configure(text='mouse click')) 10 | 11 | root.mainloop() -------------------------------------------------------------------------------- /docs/button/button0.py: -------------------------------------------------------------------------------- 1 | import tkinter as tk 2 | import tkinter.ttk as ttk 3 | 4 | root = tk.Tk() 5 | """Advantages 6 | - same class name (Button) 7 | - automatic parent (previous) 8 | - keyword not needed (text, command) 9 | - default text (Button) 10 | - command string (instead of function) 11 | - bind to Return key 12 | - automatic placement (grid) 13 | """ 14 | 15 | class Button(ttk.Button): 16 | def __init__(self, text='Button', cmd='', **kwargs): 17 | self.cmd = cmd 18 | super().__init__(root, text=text, command=self.cb, **kwargs) 19 | self.bind('', self.cb) 20 | self.grid() 21 | 22 | def cb(self, event=None): 23 | if isinstance(self.cmd, str): 24 | exec(self.cmd) 25 | else: 26 | self.cmd() 27 | 28 | def callback(): 29 | print('callback function') 30 | 31 | ttk.Button(root, text='ttk Button', command=callback).grid() 32 | Button(cmd=callback) 33 | Button('string', 'print("callback string")') 34 | Button('func', callback) 35 | Button('func', callback, pad=10) 36 | 37 | root.mainloop() -------------------------------------------------------------------------------- /docs/button/button1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rasql/tk-tutorial/e7a7697afc7fa975a4608c6305edd5bff03bfe9d/docs/button/button1.png -------------------------------------------------------------------------------- /docs/button/button1.py: -------------------------------------------------------------------------------- 1 | """Create a simple button.""" 2 | import tkinter as tk 3 | 4 | root = tk.Tk() 5 | tk.Button(root, text="Hello World").pack() 6 | root.mainloop() -------------------------------------------------------------------------------- /docs/button/button2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rasql/tk-tutorial/e7a7697afc7fa975a4608c6305edd5bff03bfe9d/docs/button/button2.png -------------------------------------------------------------------------------- /docs/button/button2.py: -------------------------------------------------------------------------------- 1 | import tkinter as tk 2 | 3 | root = tk.Tk() 4 | root.title("Feet to meters") 5 | 6 | feet = tk.StringVar() 7 | meters = tk.StringVar() 8 | 9 | def calculate(*args): 10 | try: 11 | value = float(feet.get()) 12 | meters.set(0.3048 * value) 13 | except ValueError: 14 | pass 15 | 16 | tk.Entry(root, width=10, textvariable=feet).pack() 17 | tk.Button(root, text='Convert feet to meters', command=calculate).pack() 18 | tk.Label(root, textvariable=meters).pack() 19 | 20 | root.bind('', calculate) 21 | root.mainloop() -------------------------------------------------------------------------------- /docs/button/button3.py: -------------------------------------------------------------------------------- 1 | import tkinter as tk 2 | root = tk.Tk() 3 | 4 | def callback(x): 5 | print('button', x) 6 | 7 | tk.Button(text='Button 1', command=lambda : callback(1)).pack() 8 | tk.Button(text='Button 2', command=lambda : callback(2)).pack() 9 | tk.Button(text='Button 3', command=lambda : callback(3)).pack() 10 | 11 | root.mainloop() -------------------------------------------------------------------------------- /docs/button/button4.py: -------------------------------------------------------------------------------- 1 | import tkinter as tk 2 | root = tk.Tk() 3 | 4 | tk.Button(text='Button 123', command=lambda : exec('print(123)')).pack() 5 | tk.Button(text='Button 456', command=lambda : exec('print(456)')).pack() 6 | tk.Button(text='Button 789', command=lambda : exec('print(789)')).pack() 7 | 8 | root.mainloop() -------------------------------------------------------------------------------- /docs/button/frame1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rasql/tk-tutorial/e7a7697afc7fa975a4608c6305edd5bff03bfe9d/docs/button/frame1.png -------------------------------------------------------------------------------- /docs/button/frame1.py: -------------------------------------------------------------------------------- 1 | import tkinter as tk 2 | 3 | root = tk.Tk() 4 | 5 | for x in ('flat', 'raised', 'sunken', 'solid', 'ridge', 'groove'): 6 | frame = tk.Frame(root, relief=x, borderwidth=5) 7 | frame.pack(side='left') 8 | tk.Label(frame, text=x).pack() 9 | 10 | root.mainloop() -------------------------------------------------------------------------------- /docs/button/label1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rasql/tk-tutorial/e7a7697afc7fa975a4608c6305edd5bff03bfe9d/docs/button/label1.png -------------------------------------------------------------------------------- /docs/button/label1.py: -------------------------------------------------------------------------------- 1 | import tkinter as tk 2 | 3 | root = tk.Tk() 4 | str = tk.StringVar(value='dynamic text') 5 | 6 | tk.Label(root, text='static text').pack() 7 | tk.Label(root, textvariable=str).pack() 8 | tk.Label(root, text='both', textvariable=str).pack() 9 | tk.Label(root, text='Arial 24', font='Arial 24').pack() 10 | tk.Label(root, text='foreground=red', foreground='red').pack() 11 | 12 | root.mainloop() -------------------------------------------------------------------------------- /docs/button/label2.py: -------------------------------------------------------------------------------- 1 | import tkinter as tk 2 | 3 | root = tk.Tk() 4 | 5 | for x in ('flat', 'raised', 'sunken', 'solid', 'ridge', 'groove'): 6 | tk.Label(root, text=x, relief=x, borderwidth=5).pack(side='left') 7 | 8 | root.mainloop() -------------------------------------------------------------------------------- /docs/button/tklib.py: -------------------------------------------------------------------------------- 1 | ../../tklib.py -------------------------------------------------------------------------------- /docs/canvas/canvas.rst: -------------------------------------------------------------------------------- 1 | Canvas 2 | ====== 3 | 4 | The **Canvas** widget can be used to draw lines, shapes, and text 5 | to create complex drawings and graphs. 6 | The origin (0, 0) of the canvas is in the top left corner. 7 | It has the keyword options: 8 | 9 | * background = background color 10 | * borderwidth 11 | * height 12 | * width 13 | 14 | 15 | Draw lines and rectangles 16 | ------------------------- 17 | 18 | To draw lines and rectangles, use these **create** methods: 19 | 20 | * create_line() 21 | * create_rectangle() 22 | 23 | .. image:: canvas1.png 24 | 25 | .. literalinclude:: canvas1.py 26 | 27 | :download:`canvas1.py` 28 | 29 | 30 | Create text 31 | ----------- 32 | 33 | Text can be added to a canvas with this function: 34 | 35 | * create_text() 36 | 37 | .. image:: canvas2.png 38 | 39 | .. literalinclude:: canvas2.py 40 | 41 | :download:`canvas2.py` 42 | 43 | 44 | Paint with ovals 45 | ---------------- 46 | 47 | Small ovals can be used to paint with the mouse, 48 | by binding a callback function to the mouse movement. 49 | 50 | .. image:: canvas3.png 51 | 52 | .. literalinclude:: canvas3.py 53 | 54 | :download:`canvas3.py` 55 | 56 | 57 | Polygons 58 | -------- 59 | 60 | We can add our own methods to the Canvas class. 61 | For example we can define a method to add a polygon. 62 | 63 | .. literalinclude:: tklib.py 64 | :pyobject: Canvas.polygon 65 | 66 | .. image:: canvas4.png 67 | 68 | .. literalinclude:: canvas4.py 69 | 70 | :download:`canvas4.py` 71 | 72 | 73 | Random circles 74 | -------------- 75 | 76 | The following program places circles of random size at random locations. 77 | 78 | .. image:: canvas5.png 79 | 80 | .. literalinclude:: canvas5.py 81 | 82 | :download:`canvas5.py` 83 | 84 | 85 | Canvas configuration 86 | -------------------- 87 | 88 | .. image:: canvas6.png 89 | 90 | .. literalinclude:: canvas6.py 91 | 92 | :download:`canvas6.py` 93 | 94 | 95 | Canvas configuration with tree view 96 | ----------------------------------- 97 | 98 | .. image:: canvas7.png 99 | 100 | .. literalinclude:: canvas7.py 101 | 102 | :download:`canvas7.py` 103 | 104 | 105 | Draw shapes with the mouse 106 | -------------------------- 107 | 108 | .. image:: canvas9.png 109 | 110 | .. literalinclude:: canvas9.py 111 | 112 | :download:`canvas9.py` 113 | 114 | 115 | Draw straight lines with the mouse 116 | ---------------------------------- 117 | 118 | In order to draw with the mouse we have to add two bindings to the canvas: 119 | 120 | - **** to initiate the drawing, calling the ``start()`` method 121 | - **** to update the current drawing, calling the ``move()`` method 122 | 123 | .. image:: draw1.png 124 | 125 | .. literalinclude:: draw1.py 126 | 127 | :download:`draw1.py` 128 | 129 | -------------------------------------------------------------------------------- /docs/canvas/canvas1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rasql/tk-tutorial/e7a7697afc7fa975a4608c6305edd5bff03bfe9d/docs/canvas/canvas1.png -------------------------------------------------------------------------------- /docs/canvas/canvas1.py: -------------------------------------------------------------------------------- 1 | from tklib import * 2 | app = App('Canvas with lines and rectangles') 3 | 4 | c = Canvas(width=600, height=300, background='lightblue') 5 | c.create_line(10, 10, 200, 200, fill='red') 6 | c.create_line(20, 10, 210, 200, fill='blue', width=3) 7 | c.create_rectangle(100, 200, 150, 250, fill='green', width=2) 8 | c.create_rectangle(300, 100, 580, 250, fill='yellow', width=5) 9 | 10 | app.run() -------------------------------------------------------------------------------- /docs/canvas/canvas2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rasql/tk-tutorial/e7a7697afc7fa975a4608c6305edd5bff03bfe9d/docs/canvas/canvas2.png -------------------------------------------------------------------------------- /docs/canvas/canvas2.py: -------------------------------------------------------------------------------- 1 | from tklib import * 2 | app = App('Canvas with ovals and text') 3 | 4 | c = Canvas(width=600, height=300, background='lightblue') 5 | c.create_line(10, 10, 200, 200, fill='red') 6 | c.create_line(20, 10, 210, 200, fill='blue', width=3) 7 | c.create_oval(100, 200, 150, 250, fill='green', width=2) 8 | c.create_oval(300, 100, 580, 250, fill='yellow', width=5) 9 | c.create_text(300, 150, text="Python", font='Arial 48') 10 | c.create_text(300, 250, text="Canvas", font='Zapfino 72') 11 | 12 | app.run() -------------------------------------------------------------------------------- /docs/canvas/canvas3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rasql/tk-tutorial/e7a7697afc7fa975a4608c6305edd5bff03bfe9d/docs/canvas/canvas3.png -------------------------------------------------------------------------------- /docs/canvas/canvas3.py: -------------------------------------------------------------------------------- 1 | """Painting with ovals.""" 2 | from tklib import * 3 | 4 | class Demo(App): 5 | def __init__(self): 6 | super().__init__() 7 | Label("Painting using ovals", font="Arial 24") 8 | self.c = Canvas(width=600, height=300, background='lightblue') 9 | self.c.bind('', self.paint) 10 | 11 | def paint(self, event): 12 | """Draw ovals on the canvas.""" 13 | x0, y0 = event.x-1, event.y-1 14 | x1, y1 = event.x+1, event.y+1 15 | self.c.create_oval(x0, y0, x1, y1, fill='blue') 16 | 17 | Demo().run() -------------------------------------------------------------------------------- /docs/canvas/canvas4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rasql/tk-tutorial/e7a7697afc7fa975a4608c6305edd5bff03bfe9d/docs/canvas/canvas4.png -------------------------------------------------------------------------------- /docs/canvas/canvas4.py: -------------------------------------------------------------------------------- 1 | from tklib import * 2 | app = App('Draw a polygon') 3 | 4 | c = Canvas(width=600, height=300, background='lightblue') 5 | c.polygon(150, 150, 100, 6, fill='blue') 6 | c.polygon(450, 150, 80, 8, fill='red', width=5) 7 | 8 | app.run() -------------------------------------------------------------------------------- /docs/canvas/canvas5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rasql/tk-tutorial/e7a7697afc7fa975a4608c6305edd5bff03bfe9d/docs/canvas/canvas5.png -------------------------------------------------------------------------------- /docs/canvas/canvas5.py: -------------------------------------------------------------------------------- 1 | from tklib import * 2 | app = App('Random circles') 3 | 4 | w, h = 600, 300 5 | c = Canvas(width=w, height=h, background='lightblue') 6 | 7 | for i in range(50): 8 | x = random.randint(0, w) 9 | y = random.randint(0, h) 10 | r = random.randint(10, 100) 11 | c.create_oval(x, y, x+r, y+r) 12 | 13 | app.run() -------------------------------------------------------------------------------- /docs/canvas/canvas6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rasql/tk-tutorial/e7a7697afc7fa975a4608c6305edd5bff03bfe9d/docs/canvas/canvas6.png -------------------------------------------------------------------------------- /docs/canvas/canvas6.py: -------------------------------------------------------------------------------- 1 | """Canvas config.""" 2 | from tklib import * 3 | 4 | class Demo(App): 5 | def __init__(self): 6 | super().__init__() 7 | Label("Canvas configuration", font="Arial 24") 8 | 9 | Spinbox('width', 'App.c["width"]=self.var.get()', inc=50, to=1000) 10 | Spinbox('height', 'App.c["height"]=self.var.get()', inc=50, to=1000) 11 | Combobox('background', 'white;yellow;pink;light blue', 'App.c.config(background=self.var.get())') 12 | Combobox('highlightcolor', 'black;red;blue;green', 'App.c.config(highlightcolor=self.var.get())') 13 | Combobox('relief', 'flat;sunken;raised;groove', 'App.c.config(relief=self.var.get())') 14 | Combobox('state', 'normal;disabled;hidden', 'App.c.config(state=self.var.get())') 15 | Spinbox('borderwidth', 'App.c.config(borderwidth=self.var.get())') 16 | 17 | Button('Config', 'print(App.c.config())') 18 | 19 | App.c = Canvas() 20 | 21 | Demo().run() -------------------------------------------------------------------------------- /docs/canvas/canvas7.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rasql/tk-tutorial/e7a7697afc7fa975a4608c6305edd5bff03bfe9d/docs/canvas/canvas7.png -------------------------------------------------------------------------------- /docs/canvas/canvas7.py: -------------------------------------------------------------------------------- 1 | """Canvas configuration with Treeview""" 2 | from tklib import * 3 | 4 | class Option: 5 | def __init__(self, widget): 6 | self.w = widget 7 | tree = Treeview(columns=(0)) 8 | tree.column(0, width=150) 9 | tree.heading(0, text='Value') 10 | tree.grid(row=0, column=2) 11 | 12 | d = self.w.config() 13 | print(d) 14 | for (k, v) in d.items(): 15 | if len(v)>2: 16 | tree.insert('', 'end', text=k, values=v[-1]) 17 | 18 | 19 | class Demo(App): 20 | def __init__(self): 21 | super().__init__() 22 | Label("Canvas configuration", font="Arial 24") 23 | 24 | App.stack[-1]=Frame() 25 | App.c = Canvas(background='lightblue', 26 | borderwidth=10, 27 | height=250) 28 | d = App.c.config() 29 | 30 | tree = Treeview(columns=(0)) 31 | tree.column(0, width=150) 32 | tree.heading(0, text='Value') 33 | tree.grid(row=0, column=1) 34 | 35 | for (k, v) in d.items(): 36 | if len(v)>2: 37 | tree.insert('', 'end', text=k, values=v[-1]) 38 | 39 | Option(App.c) 40 | 41 | Demo().run() -------------------------------------------------------------------------------- /docs/canvas/canvas8.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rasql/tk-tutorial/e7a7697afc7fa975a4608c6305edd5bff03bfe9d/docs/canvas/canvas8.png -------------------------------------------------------------------------------- /docs/canvas/canvas8.py: -------------------------------------------------------------------------------- 1 | """Draw lines.""" 2 | from tklib import * 3 | 4 | class Demo(App): 5 | def __init__(self): 6 | super().__init__() 7 | Label("Drawing lines", font="Arial 24") 8 | 9 | Spinbox('width', 'App.c["width"]=self.val.get()', inc=50, to=1000) 10 | Spinbox('height', 'App.c["height"]=self.val.get()', inc=50, to=1000) 11 | Combobox('fill', 'black;red;green;blue;orange;cyan', 12 | 'App.c.itemconfig(App.c.id, fill=self.val.get())') 13 | Spinbox('width', 'App.c.itemconfig(App.c.id, width=self.val.get())', from_=1, to=20) 14 | Button('Delete', 'App.c.delete(App.c.id)') 15 | Button('Delete All', 'App.c.delete("all")') 16 | 17 | App.c = Canvas() 18 | 19 | if __name__ == '__main__': 20 | Demo().run() -------------------------------------------------------------------------------- /docs/canvas/canvas9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rasql/tk-tutorial/e7a7697afc7fa975a4608c6305edd5bff03bfe9d/docs/canvas/canvas9.png -------------------------------------------------------------------------------- /docs/canvas/canvas9.py: -------------------------------------------------------------------------------- 1 | """Draw shapes with the mouse.""" 2 | from tklib import * 3 | 4 | class Demo(App): 5 | def __init__(self): 6 | super().__init__() 7 | Label("Drawing shapes", font="Arial 24") 8 | 9 | Spinbox('width', 'App.c["width"]=self.val.get()', inc=50, to=1000) 10 | Spinbox('height', 'App.c["height"]=self.val.get()', inc=50, to=1000) 11 | Separator() 12 | 13 | Combobox('fill', 'black;red;green;blue;orange;cyan', 14 | 'App.c.itemconfig(App.c.id, fill=self.val.get())') 15 | Spinbox('width', 'App.c.itemconfig(App.c.id, width=self.val.get())', from_=1, to=20) 16 | Button('Delete', 'App.c.delete(App.c.id)') 17 | Button('Delete All', 'App.c.delete("all")') 18 | Combobox('type', 'arc;line;rectangle;oval', 19 | 'App.c.itemconfig(App.c.id, fill=self.val.get())') 20 | 21 | Button('Config', 'print(App.c.itemconfig(1))') 22 | 23 | App.c = Canvas() 24 | print(vars(App.c)) 25 | print() 26 | print(dir(App.c)) 27 | 28 | App.c.create_rectangle(20, 20, 150, 100) 29 | 30 | Demo().run() -------------------------------------------------------------------------------- /docs/canvas/draw1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rasql/tk-tutorial/e7a7697afc7fa975a4608c6305edd5bff03bfe9d/docs/canvas/draw1.png -------------------------------------------------------------------------------- /docs/canvas/draw1.py: -------------------------------------------------------------------------------- 1 | # draw straight lines on a canvas 2 | from tklib import * 3 | 4 | class Canvas(tk.Canvas): 5 | """Define a canvas with line drawing""" 6 | 7 | def __init__(self, **kwargs): 8 | # super(Canvas, self).__init__(App.stack[-1], width=w, height=h, bg='light blue') 9 | super(Canvas, self).__init__(App.stack[-1], **kwargs) 10 | self.grid() 11 | self.bind('', self.start) 12 | self.bind('', self.move) 13 | self.bind('', self.print_msg) 14 | self.bind('', self.print_msg) 15 | self.bind('', self.print_msg) 16 | 17 | 18 | def start(self, event=None): 19 | # Execute a callback function. 20 | self.x0 = event.x 21 | self.y0 = event.y 22 | self.id = self.create_line(self.x0, self.y0, self.x0, self.y0) 23 | self.itemconfig(self.id, fill=color.var.get()) 24 | self.itemconfig(self.id, width=thickness.var.get()) 25 | 26 | def move(self, event=None): 27 | self.x1 = event.x 28 | self.y1 = event.y 29 | self.coords(self.id, self.x0, self.y0, self.x1, self.y1) 30 | 31 | def print_msg(self, event): 32 | print(event) 33 | 34 | app = App('Drawing lines on a canvas') 35 | color = Combobox('Color', 'black;red;green;blue;yellow;cyan;magenta') 36 | thickness = Combobox('Thickness', '1;2;5;10;20') 37 | Canvas(width=600, height=200) 38 | 39 | app.run() 40 | -------------------------------------------------------------------------------- /docs/canvas/draw2.py: -------------------------------------------------------------------------------- 1 | # draw straight lines on a canvas 2 | from tklib import * 3 | 4 | class Canvas(tk.Canvas): 5 | """Define a canvas with line drawing""" 6 | 7 | def __init__(self, **kwargs): 8 | # super(Canvas, self).__init__(App.stack[-1], width=w, height=h, bg='light blue') 9 | super(Canvas, self).__init__(App.stack[-1], **kwargs) 10 | self.grid() 11 | self.bind('', self.start) 12 | self.bind('', self.move) 13 | self.bind('', self.print_msg) 14 | self.bind('', self.print_msg) 15 | self.bind('', self.print_msg) 16 | 17 | 18 | def start(self, event=None): 19 | # Execute a callback function. 20 | self.x0 = event.x 21 | self.y0 = event.y 22 | self.id = self.create_line(self.x0, self.y0, self.x0, self.y0) 23 | self.itemconfig(self.id, fill=color.var.get()) 24 | self.itemconfig(self.id, width=thickness.var.get()) 25 | 26 | def move(self, event=None): 27 | self.x1 = event.x 28 | self.y1 = event.y 29 | self.coords(self.id, self.x0, self.y0, self.x1, self.y1) 30 | 31 | def print_msg(self, event): 32 | print(event) 33 | 34 | colors = ('red', 'blue', 'green', 'cyan', 'magenta', 'yellow', 'black') 35 | 36 | app = App('Drawing lines on a canvas') 37 | color = Combobox('Color', 'black;red;green;blue;yellow;cyan;magenta') 38 | thickness = Combobox('Thickness', '1;2;5;10;20') 39 | 40 | canvas = Canvas(width=600, height=200) 41 | 42 | x = 10 43 | d = 20 44 | for col in colors: 45 | id = canvas.create_rectangle(x, 0, x+d, d, fill=col) 46 | canvas.tag_bind(id, '', lambda e : print(eval(col))) 47 | 48 | x += d 49 | 50 | app.run() 51 | -------------------------------------------------------------------------------- /docs/canvas/tklib.py: -------------------------------------------------------------------------------- 1 | ../../tklib.py -------------------------------------------------------------------------------- /docs/check/check.rst: -------------------------------------------------------------------------------- 1 | Checkbutton 2 | =========== 3 | 4 | A **checkbutton** is like a regular button, 5 | with a label and a callback function, 6 | but it also holds and displays a binary state. 7 | 8 | The ``Checkbutton`` object has the following attributes: 9 | 10 | * **parent** - the parent object 11 | * **text** - the label to display 12 | * **command** - the callback function 13 | * **variable** - the variable holding the state value 14 | * **onvalue** - the value when in the ON state 15 | * **offvalue** - the value when in the OFF state 16 | 17 | The standard checkbutton 18 | ------------------------ 19 | 20 | Here is an example of 3 checkbuttons 21 | 22 | .. image:: check1.png 23 | 24 | The callback function ``cb`` writes this to the console:: 25 | 26 | --- languages --- 27 | English 1 28 | German 0 29 | French fluent 30 | 31 | We notice that the default offvalue is ``0`` and the default onvalue is ``1``. 32 | In our case: 33 | 34 | * var0 toggles between ``0`` and ``1`` 35 | * var1 toggles between ``barely`` and ``1`` 36 | * var2 toggles between ``0`` and ``fluent`` 37 | 38 | .. literalinclude:: check1.py 39 | 40 | :download:`check1.py` 41 | 42 | Now let us rewrite this program by using lists. 43 | 44 | .. literalinclude:: check2.py 45 | 46 | :download:`check2.py` 47 | 48 | A better Checkbutton class 49 | -------------------------- 50 | 51 | It's time now to define a new and better ``Checkbutton`` class which can do everything in one line:: 52 | 53 | Checkbutton('English;German;French', 'print(self.selection)') 54 | 55 | * the items are declared as a **semicolon-separated list** 56 | * the command is a string to be evaluated in the Checkbutton environment 57 | * the items are available in ``self.items`` 58 | * the selected items are available in ``self.selection`` 59 | * the selection states are available in ``self.val`` 60 | 61 | This is the result written to the console for three consecutive selections:: 62 | 63 | ['French'] 64 | ['German', 'French'] 65 | ['English', 'German', 'French'] 66 | 67 | .. literalinclude:: check3.py 68 | 69 | :download:`check3.py` 70 | 71 | Now let's see how this class is defined 72 | 73 | .. literalinclude:: tklib.py 74 | :pyobject: Checkbutton -------------------------------------------------------------------------------- /docs/check/check1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rasql/tk-tutorial/e7a7697afc7fa975a4608c6305edd5bff03bfe9d/docs/check/check1.png -------------------------------------------------------------------------------- /docs/check/check1.py: -------------------------------------------------------------------------------- 1 | import tkinter as tk 2 | 3 | root = tk.Tk() 4 | 5 | var0 = tk.StringVar(value='1') 6 | var1 = tk.StringVar(value='0') 7 | var2 = tk.StringVar(value='0') 8 | 9 | def cb(): 10 | print('--- languages ---') 11 | print('English', var0.get()) 12 | print('German', var1.get()) 13 | print('French', var2.get()) 14 | 15 | tk.Checkbutton(root, text='English', variable=var0, command=cb).pack() 16 | tk.Checkbutton(root, text='German', variable=var1, offvalue='barely', command=cb).pack() 17 | tk.Checkbutton(root, text='French', variable=var2, onvalue='fluent', command=cb).pack() 18 | 19 | root.mainloop() -------------------------------------------------------------------------------- /docs/check/check2.py: -------------------------------------------------------------------------------- 1 | import tkinter as tk 2 | 3 | root = tk.Tk() 4 | 5 | texts = ['English', 'German', 'French'] 6 | vars = [tk.StringVar(value='0'), tk.StringVar(value='0'), tk.StringVar(value='0')] 7 | 8 | def cb(): 9 | print('--- languages ---') 10 | for i, s in enumerate(texts): 11 | print(s, vars[i].get()) 12 | 13 | tk.Checkbutton(root, text=texts[0], variable=vars[0], command=cb).pack() 14 | tk.Checkbutton(root, text=texts[1], variable=vars[1], command=cb).pack() 15 | tk.Checkbutton(root, text=texts[2], variable=vars[2], command=cb).pack() 16 | 17 | root.mainloop() -------------------------------------------------------------------------------- /docs/check/check3.py: -------------------------------------------------------------------------------- 1 | """Create checkbuttons.""" 2 | from tklib import * 3 | 4 | app = App() 5 | Checkbutton('English;German;French', 'print(self.selection)') 6 | app.run() -------------------------------------------------------------------------------- /docs/entry/combo1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rasql/tk-tutorial/e7a7697afc7fa975a4608c6305edd5bff03bfe9d/docs/entry/combo1.png -------------------------------------------------------------------------------- /docs/entry/combo1.py: -------------------------------------------------------------------------------- 1 | from tklib import * 2 | app = App('Combobox') 3 | 4 | Label('Combobox with text entry') 5 | days = ('Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday') 6 | day = tk.StringVar() 7 | day.set(days[0]) 8 | ttk.Combobox(App.stack[-1], textvariable=day, values=days).grid() 9 | 10 | Label('state=readonly') 11 | day2 = tk.StringVar() 12 | day2.set(days[1]) 13 | ttk.Combobox(App.stack[-1], textvariable=day2, values=days, state='readonly').grid() 14 | 15 | app.run() -------------------------------------------------------------------------------- /docs/entry/combo2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rasql/tk-tutorial/e7a7697afc7fa975a4608c6305edd5bff03bfe9d/docs/entry/combo2.png -------------------------------------------------------------------------------- /docs/entry/combo2.py: -------------------------------------------------------------------------------- 1 | from tklib import * 2 | app = App('Combobox') 3 | 4 | Combobox('Weekday', 'Mon;Tue;Wed;Thu;Fri', 'print(self.item)') 5 | Combobox('Country', 'Switzerland;France;Italy;Germany', 'print(self.item)') 6 | Combobox('Year', [2005, 2006, 2007], 'print(self.item)') 7 | Combobox('Integer', list(range(10)), 'print(self.item)') 8 | 9 | app.run() -------------------------------------------------------------------------------- /docs/entry/combo3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rasql/tk-tutorial/e7a7697afc7fa975a4608c6305edd5bff03bfe9d/docs/entry/combo3.png -------------------------------------------------------------------------------- /docs/entry/combo3.py: -------------------------------------------------------------------------------- 1 | from tklib import * 2 | app = App('Combobox') 3 | 4 | Combobox('dir(tk)', dir(tk), 'print(self.item); App.entry.var.set(eval("tk."+self.item))') 5 | App.entry = Entry('value') 6 | Combobox('dir(ttk)', dir(ttk), 'print(eval("ttk."+self.item))') 7 | 8 | app.run() -------------------------------------------------------------------------------- /docs/entry/combo4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rasql/tk-tutorial/e7a7697afc7fa975a4608c6305edd5bff03bfe9d/docs/entry/combo4.png -------------------------------------------------------------------------------- /docs/entry/combo4.py: -------------------------------------------------------------------------------- 1 | from tklib import * 2 | app = App('Combobox') 3 | 4 | def cb(e=None): 5 | print(c1.var.get()) 6 | 7 | Combobox('string - "1;2;3"', '1;2;3') 8 | Combobox('tuple - (1, 2, 3)', (1, 2, 3)) 9 | Combobox('list - [1, 2, 3]', [1, 2, 3]) 10 | Combobox('range(100)', list(range(100))) 11 | Combobox('width=10', '1;2;3', width=10) 12 | 13 | c1 = Combobox('cmd function', (1, 2, 3), cb) 14 | Combobox('cmd string', (1, 2, 3), 'print(self.item)') 15 | Combobox(values='a;b;c', cmd='print(self.item)') 16 | Combobox(values='a;b;c', cmd='print(self.item)', width=10) 17 | 18 | app.run() -------------------------------------------------------------------------------- /docs/entry/demo.py: -------------------------------------------------------------------------------- 1 | from tklib import * 2 | app = App('Entry widgets') 3 | 4 | Entry('Entry', 'print(self.var.get())') 5 | Entry('', 'print(self.var.get())', val='inital value', width=10) 6 | Combobox('Combobox', 'Item 1;Item 2;Item 3', 'print(self.var.get())') 7 | Combobox('', 'Item 1;Item 2;Item 3', 8 | 'print(self.var.get())', val=2, width=10) 9 | Spinbox('Spinbox', to=10, val=5) 10 | Spinbox('', 'print(self.var.get())', to=10, width=10) 11 | Scale('Scale', 'print(self.var.get())', to=10, val=5) 12 | Scale(cmd='print(self.var.get())', to=100, length=100) 13 | 14 | app.run() -------------------------------------------------------------------------------- /docs/entry/entry.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rasql/tk-tutorial/e7a7697afc7fa975a4608c6305edd5bff03bfe9d/docs/entry/entry.png -------------------------------------------------------------------------------- /docs/entry/entry0.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rasql/tk-tutorial/e7a7697afc7fa975a4608c6305edd5bff03bfe9d/docs/entry/entry0.png -------------------------------------------------------------------------------- /docs/entry/entry0.py: -------------------------------------------------------------------------------- 1 | from entry import * 2 | 3 | app = App('Entry, Combobox, Spinbox') 4 | 5 | Entry('Entry', val='enter text') 6 | Combobox('Combobox', 'select item;item 2') 7 | Spinbox('Spinbox', val=5, to=10) 8 | Scale('Scale') 9 | 10 | app.run() -------------------------------------------------------------------------------- /docs/entry/entry1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rasql/tk-tutorial/e7a7697afc7fa975a4608c6305edd5bff03bfe9d/docs/entry/entry1.png -------------------------------------------------------------------------------- /docs/entry/entry1.py: -------------------------------------------------------------------------------- 1 | import tkinter as tk 2 | root = tk.Tk() 3 | 4 | name = tk.StringVar() 5 | tk.Label(text='Name').pack() 6 | tk.Entry(root, textvariable=name, width=10).pack() 7 | 8 | password = tk.StringVar() 9 | tk.Label(text='Password').pack() 10 | tk.Entry(root, textvariable=password, show='*').pack() 11 | 12 | root.mainloop() -------------------------------------------------------------------------------- /docs/entry/entry2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rasql/tk-tutorial/e7a7697afc7fa975a4608c6305edd5bff03bfe9d/docs/entry/entry2.png -------------------------------------------------------------------------------- /docs/entry/entry2.py: -------------------------------------------------------------------------------- 1 | """Create entry fields.""" 2 | from tklib import * 3 | app = App('Entry') 4 | 5 | Label('Entry fields', font='Arial 24') 6 | Entry('First name:', 'print(self.var.get())', 'James') 7 | Entry('Last name:', 'print(self.var.get())') 8 | Entry('Password:', 'print(self.var.get())', show='*') 9 | 10 | Entry('Enter expression', 'App.res["text"] = eval(self.var.get())') 11 | App.res = Label('Result') 12 | 13 | app.run() 14 | -------------------------------------------------------------------------------- /docs/entry/scale1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rasql/tk-tutorial/e7a7697afc7fa975a4608c6305edd5bff03bfe9d/docs/entry/scale1.png -------------------------------------------------------------------------------- /docs/entry/scale1.py: -------------------------------------------------------------------------------- 1 | from tklib import * 2 | 3 | app = App('Scale') 4 | ttk.Scale(App.stack[-1]).grid() 5 | ttk.Scale(App.stack[-1], length=200, to=100).grid() 6 | ttk.Scale(App.stack[-1], length=300, from_=-100, to=100).grid() 7 | app.run() -------------------------------------------------------------------------------- /docs/entry/scale2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rasql/tk-tutorial/e7a7697afc7fa975a4608c6305edd5bff03bfe9d/docs/entry/scale2.png -------------------------------------------------------------------------------- /docs/entry/scale2.py: -------------------------------------------------------------------------------- 1 | from entry import * 2 | 3 | app = App('Scale') 4 | Scale('Scale', 'print(self.var.get())', to=10, length=200) 5 | Scale('from=-50, to=50', 'print(self.var.get())', from_=-50, to=50) 6 | 7 | app.run() -------------------------------------------------------------------------------- /docs/entry/spinbox1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rasql/tk-tutorial/e7a7697afc7fa975a4608c6305edd5bff03bfe9d/docs/entry/spinbox1.png -------------------------------------------------------------------------------- /docs/entry/spinbox1.py: -------------------------------------------------------------------------------- 1 | from tklib import * 2 | 3 | app = App('Spinbox') 4 | 5 | var1 = tk.StringVar(value='10') 6 | ttk.Spinbox(App.stack[-1], from_=5.0, to=100.0, increment=25, textvariable=var1).grid() 7 | 8 | # default increment=1, from_=0, to=0 9 | var2 = tk.StringVar(value='2') 10 | ttk.Spinbox(App.stack[-1], to=10, textvariable=var2).grid() 11 | 12 | # how to use a value list 13 | values = 'Frank;Conny;Jim'.split(';') 14 | var3 = tk.StringVar(value=values[0]) 15 | ttk.Spinbox(App.stack[-1], values=values, textvariable=var3).grid() 16 | 17 | app.run() -------------------------------------------------------------------------------- /docs/entry/spinbox2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rasql/tk-tutorial/e7a7697afc7fa975a4608c6305edd5bff03bfe9d/docs/entry/spinbox2.png -------------------------------------------------------------------------------- /docs/entry/spinbox2.py: -------------------------------------------------------------------------------- 1 | from entry import * 2 | app = App('Spinbox') 3 | 4 | Spinbox('values=(1, 2, 5, 50)', values=(1, 2, 5, 10), val=5) 5 | Spinbox('from_=-5, to=5', from_=-5, to=5, wrap=True) 6 | Spinbox('to=5, wrap=True', to=5, wrap=True) 7 | Spinbox('to=50, increment=5', to=50, increment=5) 8 | Spinbox('to=1, increment=0.1', to=1, increment=0.1) 9 | Spinbox(' self.configure()', 'print(self.configure())') 10 | Spinbox(' self.var.get()', 'print(self.var.get())', to=5) 11 | Spinbox('state=disabled', to=5, state='disabled', val=2) 12 | Spinbox('state=readonly', to=5, state='readonly', val=2) 13 | app.run() -------------------------------------------------------------------------------- /docs/entry/template.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rasql/tk-tutorial/e7a7697afc7fa975a4608c6305edd5bff03bfe9d/docs/entry/template.png -------------------------------------------------------------------------------- /docs/entry/template.py: -------------------------------------------------------------------------------- 1 | from tklib import * 2 | app = App('Template') 3 | Button() 4 | label = Label() 5 | label.text = 'New label' 6 | app.run() -------------------------------------------------------------------------------- /docs/entry/tklib.py: -------------------------------------------------------------------------------- 1 | ../../tklib.py -------------------------------------------------------------------------------- /docs/event/event1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rasql/tk-tutorial/e7a7697afc7fa975a4608c6305edd5bff03bfe9d/docs/event/event1.png -------------------------------------------------------------------------------- /docs/event/event1.py: -------------------------------------------------------------------------------- 1 | from tklib import * 2 | 3 | def cb(event): 4 | """Callback function.""" 5 | print(event) 6 | 7 | app = App('Events and bindings') 8 | 9 | Label("Button and Motion events", font="Arial 24") 10 | Label('Display the event in the status bar') 11 | 12 | app.root.bind('