Home > Back-end >  stuff inside frame in .grid() method doesn't seem to wanna work
stuff inside frame in .grid() method doesn't seem to wanna work

Time:11-16

trying to use the .grid method to make a school assignment and stuff i try to have under a frame seems to ignore the frame's position, is there a way to have it stay inside the frame? or in summary can stuff be put inside frames and be placed alongside the frame?

used code:

from tkinter import *
import random as rn

hlavni=Tk()
hlavni.geometry('500x400')
hrac_f=Frame(hlavni,width=100,height=100,bg="red")
hrac_f.grid(row=0,column=1,padx=20,pady=20)
test1=Label(hrac_f,text="why").grid(row=0,column=0,padx=20,pady=20)
hlavni.mainloop()

picture of what i am getting current wrong result

i tried looking through forums and tried using tutorial vids but none had the information i was looking for.

what i am trying to achieve rn: current next goal

final goal of the assignment(if there exists a better solution the one i am trying to use): the assignment

CodePudding user response:

This what is my bot had said :)) lol

from tkinter import *
import random as rn
#This is fucking BUG
hlavni=Tk()
hlavni.geometry('500x400')
hrac_f=Frame(hlavni,width=100,height=100,bg="red")
hrac_f.grid(row=0,column=1,padx=20,pady=20)
test1=Label(hrac_f,text="why").grid(row=0,column=0,padx=20,pady=20)
hlavni.mainloop()
  • Related