0

I have a problem that has been already discussed on stackoverflow many time, but I still do not understand, how can I adjust my code to work properly. Here is my code:

import tkinter as tk
root = tk.Tk()


def raise_bilance():

    labelframe = tk.LabelFrame(root, text="Bilance today")
    labelframe.pack(fill="both", expand="yes")

    left = tk.Label(labelframe, text="Profit $1.000.000")
    left.pack()


f1 = tk.Frame(root)


f1.grid(row=0, column=0, sticky="news")

tk.Button(
    f1, text="Click on me", command=lambda: raise_bilance()
).pack()
tk.Label(f1, text="Click").pack()


raise_frame(f1)
root.mainloop()

I got this error:

_tkinter.TclError: cannot use geometry manager pack inside . which already has slaves managed by grid

How can I modify my code to work properly, please? I tried to replace pack() with grid() and vice versa, but it did not help me.

D_00
  • 1,440
  • 2
  • 13
  • 32
vojtam
  • 1,157
  • 9
  • 34

0 Answers0