Swapping between Frames with Tkinter tkraise()

Поделиться
HTML-код
  • Опубликовано: 3 окт 2024
  • In this Tkinter Video Tutorial, we will explore how to "swap" between different Windows (or Frames) using the tkraise() method.
    Instead of creating a new window every time you want to display something new, you can just "swap" the Frame instead with another. Once you are done, you can "swap" the original frame back in with tkraise!

Комментарии • 16

  • @angelmusonda7951
    @angelmusonda7951 8 месяцев назад +1

    I am very sure that even if you comment out tkraise(), the code will still work and achieve the same object. What exactly is the purpose of tkraise()?

  • @Not_A_Lazy_Dev
    @Not_A_Lazy_Dev Год назад

    so tkraise() is used to put the frames on top of each other and not to put them below each other

  • @sunnypepple6571
    @sunnypepple6571 10 месяцев назад

    Can it be further enhanced with dictionaries aside instead of using indexes?

  • @nonhlanhlaradebe-ig9wr
    @nonhlanhlaradebe-ig9wr 8 месяцев назад

    What is the value of the master?

  • @samuelaniogbu5089
    @samuelaniogbu5089 Год назад

    Hi, thanks alot for this tutorial. It really helped me get through a solution I was trying to implement. So I'm done fixing up my code and I have a new problem at hand. The first window I created has entry widgets to which I assigned self.stringvar() variables. The second window contains radio buttons which were linked to a booleanvar. Now after subclassing the first and second windows as shown in your tutorial, how do I get the values from widgets in the first and second window in the main window. The form I designed has a submit button in the bottom frame. However when I click on that button; an error is thrown telling me the mainframe has no named entry and radiobutton attributes. Can you help me with this? Thanks

    • @samuelaniogbu5089
      @samuelaniogbu5089 Год назад

      Successfully resolving this is key to the problem I'm working on.
      The switch button works perfectly well as it enables me change views. However, I can't access the value of variables in each widget in the first and second windows.

    • @coderslegacy5661
      @coderslegacy5661  Год назад +1

      Can't really tell what the problem is without seeing any code, but I actually made a whole video on a similar concept, because I know people have alot of trouble passing values back and forth between different windows/frames.
      Here is a link: ruclips.net/video/wHeoWM4xv0U/видео.html

    • @samuelaniogbu5089
      @samuelaniogbu5089 Год назад

      @@coderslegacy5661 I have seen this video tutorial and also read up on it from your blog which I bookmarked. But I'm still trying to figure out if it'll work in this case. I think the tk.raise() method used to switch frames doesn't support passing variables from child frames to parent. Or what do you think?

  • @sunnypepple6571
    @sunnypepple6571 10 месяцев назад

    The situation did not address between 5 to 10 windows. In what way would we handle 5 windows?

    • @coderslegacy5661
      @coderslegacy5661  10 месяцев назад

      A situation like that would be rather unusual, but the same concept can be applied to 5 frames as well. If you know how to swap two frames, then you can swap any number of frames.

    • @sunnypepple6571
      @sunnypepple6571 10 месяцев назад

      @@coderslegacy5661 this time around instead of dealing with indexes you are dealing with the named of the classes.

  • @hansedbertelian9520
    @hansedbertelian9520 Год назад

    hey thank you for ur lesson, can i ask? what if we have 3 frames? is it the same?

    • @coderslegacy5661
      @coderslegacy5661  Год назад

      Same core logic, yes.

    • @hansedbertelian9520
      @hansedbertelian9520 Год назад

      @@coderslegacy5661 thanks for your reply but the first frame on the framelist (0) wont show up, what happend??

    • @coderslegacy5661
      @coderslegacy5661  Год назад

      @@hansedbertelian9520 Can't really tell without any code.

  • @ReinventedWeb
    @ReinventedWeb Год назад

    👍