DEV Community

Cover image for Frames in tkinter
Akram Narejo
Akram Narejo

Posted on


Frames in tkinter

from tkinter import *

class Frames:

    def makeFrame(self):
        root = Tk(className="X Name")
        root.title("X title")

        def raise_frame(frame):

        frame1 = Frame(root, width=600)
        frame2 = Frame(root)

        for frame in (frame1,frame2):
            frame.grid(row=0, column=0, padx=50, pady=200, sticky='news')

        Label(frame1, text='Welcome to tkinter Frames',font=("Courier",40)).pack()
        Button(frame1, text="Frame 2", width=10,height=2, font=("Courier", 30), command=lambda:raise_frame(frame2)).pack(pady=10)

        Label(frame2, text='Frame 2', font=("Courier",40)).pack()
        Button(frame2, text="Frame 1",width=10,height=2, font=("Courier", 30), command=lambda:raise_frame(frame1)).pack(pady=10)


frame = Frames().makeFrame()

Enter fullscreen mode Exit fullscreen mode

like to support & share to help <3

Oldest comments (0)

Timeless DEV post...

Git Concepts I Wish I Knew Years Ago

The most used technology by developers is not Javascript.

It's not Python or HTML.

It hardly even gets mentioned in interviews or listed as a pre-requisite for jobs.

I'm talking about Git and version control of course.

One does not simply learn git