The need for the __init__ method and self parameter when inheriting with tkinter

Sdílet
Vložit
  • čas přidán 28. 08. 2024

Komentáře • 24

  • @griggerykimothy4865
    @griggerykimothy4865 Před rokem +1

    Thank you so much! I've been struggling with this for days but this explanation made it click!

    • @johnphilipjones
      @johnphilipjones  Před rokem +1

      It's pleasing to know that it helped. Best wishes Phil

  • @aaaa-kh7ol
    @aaaa-kh7ol Před 5 lety +9

    This is a deluxe explanation. It is not easy to get such a good explanation. Believe me. It will save you many hours trying to understand important and fundamental concepts about classes, in any language. So pay special attention to these topics here. Congratulations.

  • @shanerooney7288
    @shanerooney7288 Před 4 lety +1

    I was stuck for days on __init__, and this video helped me so much.
    I already understood everything, or at least I thought I did, but in the end I was making one simple mistake that kept crashing my code -- confusing "self" and "window" as the same thing. When in retrospect it should have been clear that he window was the parent of the object and not the object itself.
    Thank you. May the all mighty CZcams algorithim bless your channel.

  • @MaxGoddur
    @MaxGoddur Před 6 lety +2

    Bravo. Expanding on the ID and SELF is something needed to drive the point home of the relationship between the two.

  • @resrussia
    @resrussia Před 5 lety +1

    The best explanation of how objects are created. As someone making a journey from the social sciences into programming, I greatly appreciate the excellent explanations.

  • @ibrahimibo95
    @ibrahimibo95 Před 2 lety +2

    A professor who has five information and can deliver it to the learner is better than a brilliant programmer who has 1,000 information and is unable to deliver one to the learner...And you are a wonderful teacher

    • @johnphilipjones
      @johnphilipjones  Před 2 lety +1

      Thank you for your generous comments.
      Best wishes Phil

  • @JohnCena963852
    @JohnCena963852 Před 5 lety +2

    This explanation is so clear and straightforward. Thank you sir.

  • @andreassalbach5039
    @andreassalbach5039 Před 3 lety +1

    wow very good explanation thank you.

  • @sanjurotsubaki3683
    @sanjurotsubaki3683 Před 5 lety

    For those wondering the syntax to inherit from Frame class in python 2.(...) is:
    Frame.__init__(self)
    P.S. Fantastic videos on Tkinter. I wish there were more, since I'm nearing the end of the list.

  • @handris99
    @handris99 Před 5 lety

    Your videos are really good teacher quality. Better than some of the Udemy courses I've checked. One tip to help viewers. You could include in the description a link to the playlist the video is in. It would really help people stay on your channel.

    • @johnphilipjones
      @johnphilipjones  Před 5 lety

      Thank you for the positive feedback. I will add links as you suggest. Can I also direct you to the supporting website where the videos are organised into playlists. They are much easier to follow on the website. The link is www.pythonbytesize.com/video-list-website.html

  • @symphonyw723
    @symphonyw723 Před 5 lety

    Ossamm .. Thank you sir ..

  • @sudhirkaushik4786
    @sudhirkaushik4786 Před 6 lety

    please make a series on threading,gil and multiprocessing in python please give complete reviews on each topic sir

  • @crossfarm4146
    @crossfarm4146 Před 4 lety

    Hey John, Apologies if asking this question is redundant, but do you have any videos that explain the concept of using these Frame classes in regards to navigation? So for example, I want to create a Frame that is a Login screen, and then once a button is clicked, It changes the Frame to the next screen. I've been able to accomplish this very crudely by using .grid_forget() for all the elements of that Frame, and then re-establishing them when I need to navigate back. I would imagine that I could use something like frame_a.grid_forget then frame_b.grid(row=0,column=0) and then vice versa when navigating backwards. Am I on the right track?

    • @johnphilipjones
      @johnphilipjones  Před 4 lety +1

      I will do a video on how to do this. It should be ready at the beginning of next week. Best wishes Phil

  • @novicetech1
    @novicetech1 Před 6 lety

    This is really good. I would ask, however, if you are going to make reference to a previous video, please provide a link to it. I have know way of knowing which of your many videos is the 'previous' video. Thanks.

    • @johnphilipjones
      @johnphilipjones  Před 6 lety

      The links to the previous two videos are shown below:
      czcams.com/video/2otH7ajZF9c/video.html
      czcams.com/video/HTyN25rnla0/video.html
      All my videos are uploaded to CZcams but they are also embedded on a dedicated website where they are organised into appropriate playlists and the previous videos are then easy to locate. The link to the website is below:
      www.pythonbytesize.com/
      Best wishes
      Phil

    • @stevew9945
      @stevew9945 Před 6 lety

      Look at play lists they put them in order

  • @soundarapandian6615
    @soundarapandian6615 Před 3 lety

    I THINK I understand; but a sub class can be more useful if only we can add more attributes to it, otherwise we are only using it as a rubber stamp (to save lines of code; I can simply copy & paste the lines). I need to find out more about the purpose & objective of inheritance. Otherwise your explanation was methodical and graphics were useful. You have taken lots of pain in preparing the video. Thank you.

    • @johnphilipjones
      @johnphilipjones  Před 3 lety

      You are correct it would normally be the case that you would add attributes to the subclass. In effect this would extend the features of subclass instances when compared to the super class instances. In this video I have avoided extending to subclass. This was done to allow concentration on the self parameter. On reflection I should have added some extra functionality to the subclass. My attempt to simplify matters here may have backfired. Sorry about that.
      Best wishes
      Phil

    • @soundarapandian6615
      @soundarapandian6615 Před 3 lety +1

      @@johnphilipjones Oh, no, please don't be sorry, Phil. I am clear about the use of 'self'. I have seen 'this' being used in some places but I never understood it until after going through your explanation. I was not clear on how I could extend the the attributes in the sub class, say using gradient color for 'bg' (e.g., red at the bottom and fading to white at the top). I loved your graphics in the "Execution Space" , and the code execution order was VERY useful for me to understand the whole process. Thank you and best wishes for you, too!