Hello I have a several problems with using tkinter, if anybody can help, it would be great :D

I'm using a .grid method on my widgets. When I put sth (e.g.Label) in for example row=5, and want to put something different (label with other text)in row=5 it overlap one another ;/ I don't know how to make invisible previous label. And .destroy() method doesn't want work;/

Another problem:

def show():
    i=0
    wpisy = (here is some text, read from file)
        [B]wartosc[/B]=Text(root, relief=SOLID,bd=0,fg="#7b6262",     height=20, width=65, font=("Arial", 9, "normal"))
     wartosc.grid(row=2,columnspan=3)
     wartosc.insert(END, wpisy)

When some button activate show() function, text appear in Text widget, but when I put some another text (via Entry/button widget -> function which put it there) and activate show() once again, new text doesn't appear in wartosc. It can't be refreshed or sth ?
Plz help:)

This is one way to hide and show widgets that share the same grid ...

# hide and show labels sharing the same grid
 
import Tkinter as tk
 
def show2():
    label1.lower()
    label2.lift()
 
def show1():
    label2.lower()
    label1.lift()
 
root = tk.Tk()
button1 = tk.Button(root, text="Press to show label2", command=show2)
button1.grid(row=0, column=0)
button2 = tk.Button(root, text="Press to show label1", command=show1)
button2.grid(row=1, column=0)
label1 = tk.Label(root, text="text in label1", bg='yellow')
label1.grid(row=2, column=0)
label2 = tk.Label(root, text="text in label2", bg='green')
label2.grid(row=2, column=0)
# label1 and label2 share the same grid
# this will put label2 below label1
label2.lower()
root.mainloop()

Oh, I see. You use lower() and lift() methods. I don't know them :). It's effortless. Thank you :D

hmm. I see one bug. lower nad lift can only arrange a position on labels, but when labels on top has shorter text than label below, that one below is still visible ;/

Make the two labels the same width by adding for instance width=30 to the arguments.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.