Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Tkinter guide?
#1
I´m starting learning tkinter and trying to make some sense of it.
I´d like to know if there is a good manual or guide with all the options, etc.?
For instance, I am doing this simple example:

win = tk.Tk()
win.title("My program")
win.resizable(False, False)
win.mainloop()
Where can I see a guide with all the methods available in the Tk class, like "title", "resizable", "mainloop", etc.?
I´ve been having a look at the official tkinter info, but that´s like chinese for me, and can not find those methods.

I´ve also tried the suggested Tk commands page (also quite complicated for me), but still couldn´t find those methods or the way to implement them anywhere. I just wonder how the person who wrote that code came to learn how to do it by him/herself. Where did he or she go for that information?
Following the example, what other methods are available for the class Tk and how to use them?

For instance, how can I figure out for myself how to make the window fullsize or topmost when running the program?

As you can see, I´m quite at a loss right now...
Any help is welcome
Reply
#2
There are lots of free books in pdf format, e.g.
Python GUI Programming With Tkinter
or
Tkinter By Example
Reply
#3
(answer sent inadvertently before finishing)
Reply
#4
Sure, but all the books of this kind I have consulted just give you examples for learning this and that.
I wonder if there is an official guide or reference with all the options.

As I said, say I want to make the main window fullscreen.
Reading the Tkinter official Python page I couldn´t find this option or how to do it, but I came to realize this module is based on Tk, then at some point I understand that a Tk instance inherits (or whatever it is called) from "wm", and finally I have found that "wm" on the TK commands documentation, which says.

wm attributes window ?option value option value...?
This subcommand returns or sets platform specific attributes associated with a window. The first form returns a list of the platform specific flags and their values. The second form returns the value for the specific option. The third form sets one or more of the values. The values are as follows:
All platforms support the following attributes (though X11 users should see the notes below):
-fullscreen Places the window in a mode that takes up the entire screen, has no borders, and covers the general use area (i.e. Start menu and taskbar on Windows, dock and menubar on OSX, general window decorations on X11).


Now, I don´t know a word about Tk/Tcl (I´m trying to learn Python, not other programming language!), but kind of comparing visually
with wm.resizable(False, False)
I guess it has to be something along the lines of
wm.fullsize()
wm.attributes.fullsize()
or something close to that (I´ve have "brute force" tried these and other options, just in case, with no luck).

Anyway, my point is that Python is said to be an easy language... In my opinion, this seems very very complicated!! And only to create a simple GUI!!! I only know a bit about other programming language, AutoHotkey, and gosh, it is so much much easier, intuitive and quick to make a GUI. Also the online reference is simple, direct and clear. I am trying to find something similar explaining how to create a GUI using the tkinter module.

Many thanks anyway.
Reply
#5
Then why not use one of the wrappers around tkinter like e.g. PySimpleGUI. I also thought tkinter, and other GUI stuff was complicated so when asked to create a simple Japanese character learning application I used PySimpleGUI with quite rapid success.
Generally speaking, GUI programming is a lot of work as you have to manage all the details of a window and its components + connect all those details to code that will perform whatever action is to be taken. Regardless of language it is not a simple task.
Tried to put an image here but failed...
Reply
#6
Took a look at AutoHotKey and for the simplest of tasks it seems simple but if you want to do complicated stuff it does not seem simpler than other GUI builders and, on top of that, it's only for windows. It's OK if you are a windows-only user but if you want your app to work on another platform you need to learn another GUI builder or another language. My PySimpleGUI app runs on all platforms, thanks to Python.
Reply
#7
Sure, my knowledge of programming is very limited, but I think you are right.
Reply
#8
Quite old but very good for start and my all time favorite - New Mexico Tech tutorial on tkinter. Here is a fork because they no longer host it:
https://anzeljg.github.io/rin2/book2/240...index.html

also
https://docs.python.org/3/library/tk.html
https://www.python-course.eu/python_tkinter.php
https://realpython.com/python-gui-tkinter/


Also, you may consider other frameworks for GUI, like wxPython Phoenix or some other
If you can't explain it to a six year old, you don't understand it yourself, Albert Einstein
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs

Reply
#9
What programming languages have you used in the past to write GUI applications. Which GUI toolkit did you use?

The definitive guide to tkinter is the Tk/Tcl documentation. tkinter is a thin Python wrapper around a C++ library. Setting a widget attribute in Python maps to a method call in C++ almost 1 for 1.
Reply
#10
I recommend watching tutorials on YouTube,
That's the way I learned,
https://www.youtube.com/channel/UCFB0dxM...q8w5NJEAmw
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Guide Tinker tranduc 1 1,964 May-06-2020, 08:51 AM
Last Post: pyzyx3qwerty
  a GUI beginner guide Skaperen 8 4,630 Aug-12-2018, 08:31 PM
Last Post: Skaperen

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020