Python: TKinter Class Based Windows

preview_player
Показать описание
This video covers class based windows. A class based window is a window created using a custom class, where the properties and methods are encapsulated into a single object. Class based windows (CBW) are important when you want your methods to manipulate data. Without CBW, you are forced to operate through global variables, which is the number 1 rule for programming: try to never use global variables!! The window's properties are set using the init method, and all methods operate through the instance of the class. Feel free to leave any comments, questions, or suggestions below!

Good sources to learn Python:

Рекомендации по теме
Комментарии
Автор

Excellent. I love the fast pace and specificity of this.

martincregg
Автор

This is the video I've been long looking for.

guogeorge
Автор

I think you can use global n in the increment function for accessing the n global variable

khalilazooz
Автор

Using the global attribute inside the function would make it work just fine, increasing n variable and so on. Why would you put global in global scope? Never seen that

vladbondar
Автор

Hi I am looking for tkinter class based windows... did you make other tkinter tutorials using classes or is this the only one?

SA-ojbo
Автор

Why is it that you didn't need to say text=self.message when creating the label, and that you didn't need to assign a variable to the label like you did with the button?
Thanks and great video

karans
Автор

Exactly what I was looking for! Instantly subscribed :)

noahrubin
Автор

Thank you for clear explanation! i have 2 questions

can we put self.root=Tk() within __init__? and what would make it different?

def __init__(self, root, title, geometry, message):
self.root=Tk()


also are we free to not put root to __init__ args?
def __init__(self, title, geometry, message):
self=Tk()
would this still work as fine?

masekin
Автор

what is the function of "pass" in the class window?

nurfathiah
Автор

hello, great video ! i just have a litle problem in the console they said ```local variable 'main_window' referenced before assignment```

appleshare
Автор

hi i was dealing with some prject . Can you giv e me some idea how to make for example online consular services system based on class with using tkinter and creatin GUI for it

gizemavc
Автор

Wrong title. You should have title it: „The benefits of using classes over functions”
The title of the video suggest you were going to show and explain how to construct Tkinter classes and use it within oop apps.
Also, why not inherit from tkinter? Saves a lot of typing…

Matt-iycf
Автор

I'm really having trouble wrapping my head around OOP :(

mustache
Автор

You did so many things wrong. Its weird . You understand some programming but your not using classes correctly or functions . The function example you gave worked for your explanarion only because you were not using the function properly to achieve something that a function can easily do.

producersunite