Bottom Page

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
 Issue on tkinter with buttons
#1
Hi, Here's my problem I want that when You press "button3" after having pressed"button", it also destroys label6 from" do_it" function.



    def do_it():
        F= calcul_salarie(i.get(), k.get(), revenu_moyen.get(), trimestre_cotisés.get(), enfants.get())
        G=F/12
        RA=int(F/12)
        A= str(i.get())+", Ta pension de retraite sera de: "+str(F)+"€ par an, soit de :"+str(RA)+"€ par mois"

        button.destroy()
        label6= Label(Appli,text=A,font=("arial",15,"bold"), fg="black")
        label6.place(x=20, y=100)
        
        





    def return_page():
        button3.destroy()
        page_principale()
        label1.destroy()
        entry_box1.destroy()
        label2.destroy()
        entry_box2.destroy()
        label3.destroy()
        entry_box3.destroy()
        label4.destroy()
        entry_box4.destroy()
        label5.destroy()
        entry_box5.destroy()
        label6.destroy()

    button= Button(Appli, text="Calulate", width="18", height="9",command=do_it,bg="white")
    button.place(x=500, y=470)

    button3= Button(Appli, text="Initial page", width="18", height="9",command=return_page,bg="white")
    button3.place(x=50,y=200)

    
Quote
#2
Hi!
label6 is a local variable and cannot be seen in another function. Do it at the beginning of the code. If you do not want it to be immediately visible, then do not use the label6.place () method.
Quote

Top Page

Possibly Related Threads...
Thread Author Replies Views Last Post
  Need tkinter help with clicking buttons pythonprogrammer 2 132 Jan-03-2020, 04:43 AM
Last Post: joe_momma
  Tkinter Buttons action d3fi 1 151 Nov-20-2019, 09:16 PM
Last Post: Larz60+
  Nesting menu buttons tkinter for python Mocap 1 339 Jul-18-2019, 11:46 AM
Last Post: metulburr
  [Tkinter] Tkinter window issue frequency 4 742 Dec-24-2018, 10:49 AM
Last Post: frequency
  Tkinter positional information issue thatguy14 4 1,015 Jul-05-2018, 06:49 PM
Last Post: woooee
  [Tkinter] Aligning Python Tkinter Buttons In Rows TollyThaWally 3 3,083 Feb-22-2018, 02:56 AM
Last Post: woooee
  Multi windows in tkinter buttons not responding correctly curtjohn86 13 4,286 Jul-01-2017, 03:42 PM
Last Post: nilamo

Forum Jump:


Users browsing this thread: 1 Guest(s)