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
  [Tkinter] tkinter: after issue edwin6938 1 111 Aug-25-2020, 04:37 PM
Last Post: Larz60+
  Tkinter: increasing numbers and Radiobutton issue PeroPuri 1 267 Apr-13-2020, 05:48 PM
Last Post: deanhystad
  [Tkinter] tkinter issue with variables carrying over between functions PengEng 1 306 Apr-06-2020, 06:13 PM
Last Post: deanhystad
  TkInter Binding Buttons ifigazsi 5 352 Apr-06-2020, 08:30 AM
Last Post: ifigazsi
  Need tkinter help with clicking buttons pythonprogrammer 2 415 Jan-03-2020, 04:43 AM
Last Post: joe_momma
  Tkinter Buttons action d3fi 1 420 Nov-20-2019, 09:16 PM
Last Post: Larz60+
  Nesting menu buttons tkinter for python Mocap 1 679 Jul-18-2019, 11:46 AM
Last Post: metulburr
  [Tkinter] Tkinter window issue frequency 4 1,075 Dec-24-2018, 10:49 AM
Last Post: frequency
  Tkinter positional information issue thatguy14 4 1,348 Jul-05-2018, 06:49 PM
Last Post: woooee
  [Tkinter] Aligning Python Tkinter Buttons In Rows TollyThaWally 3 4,575 Feb-22-2018, 02:56 AM
Last Post: woooee

Forum Jump:


Users browsing this thread: 1 Guest(s)