Python Forum
[Tkinter] How to perform math function in different page of Tkinter GUI
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[Tkinter] How to perform math function in different page of Tkinter GUI
#1
Star 
from tkinter import *
from functools import partial
  
def raise_frame(frame):
    frame.tkraise()
  
win = Tk()
win.geometry("400x300+10+10")
win.title("Calculator")
 
third_frame = Frame(win)
third_frame.place(x=0, y=0, width=400, height=300) 

second_frame = Frame(win)
second_frame.place(x=0, y=0, width=400, height=300)
 
first_frame = Frame(win)
first_frame.place(x=0, y=0, width=400, height=300)
 
label_0 = Label(first_frame, text="CHOOSE NUMBER OF INPUT",width=30,font=("bold", 12))
label_0.place(x=60,y=50)
    
Button(first_frame, text='2 inputs',width=10,font=("bold", 10),bg='yellow',fg='black', command=lambda:raise_frame(second_frame)).place(x=155,y=150)


Button(second_frame, text="Back to Front Page",width=18,bg='brown',fg='white', command=lambda:raise_frame(first_frame)).place(x=20,y=260)           
              

label_1 = Label(second_frame, text="Digit  1",width=10,font=("bold", 10))
label_1.place(x=100, y=50)

entry_1 = Entry(second_frame)
entry_1.place(x=200,y=50)

label_2 = Label(second_frame, text="Digit 2",width=10,font=("bold", 10))
label_2.place(x=100,y=100)
#RT = get()(second_frame, entry1, entry2.get())
  
entry_2 = Entry(second_frame)
entry_2.place(x=200,y=100)  
  
label_3 = Label(second_frame, text="Result",font=("bold", 10))
label_3.place(x=100,y=200)

entry_3 = Entry(second_frame)
entry_3.place(x=200,y=200)
#RT = (entry_1,get() + entry_2,get())
#entry_3.second_frame, insert(END, str(RT))  
  


Button(second_frame, text='ADD',width=10,bg='blue',fg='black').place(x=100,y=150)  

#second_frame.entry1, R1 = int(get())

    #entry_2.delete(0,END)
    #R1=int(entry_1.get())
    #R2=int(entry_2.get())
    #RT= R1 + R2
    #entry_3.insert(END, str(RT))  
    
    
Button(second_frame, text='SUB',width=10,bg='blue',fg='black').place(x=200,y=150)              



win.mainloop()
Larz60+ write Oct-23-2020, 03:09 AM:
Please post all code, output and errors (it it's entirety) between their respective tags. Refer to BBCode help topic on how to post. Use the "Preview Post" button to make sure the code is presented as you expect before hitting the "Post Reply/Thread" button.
Fixed for you this time.
Reply


Messages In This Thread
How to perform math function in different page of Tkinter GUI - by ravaru - Oct-23-2020, 02:45 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Using Tkinter inside function not working Ensaimadeta 5 5,079 Dec-03-2023, 01:50 PM
Last Post: deanhystad
  Tkinter won't run my simple function AthertonH 6 3,894 May-03-2022, 02:33 PM
Last Post: deanhystad
  how to add two numbers and pass the result to the next page in tkinter? pymn 7 4,362 Feb-15-2022, 04:40 AM
Last Post: pymn
  [Tkinter] tkinter best way to pass parameters to a function Pedroski55 3 4,893 Nov-17-2021, 03:21 AM
Last Post: deanhystad
  Creating a function interrupt button tkinter AnotherSam 2 5,563 Oct-07-2021, 02:56 PM
Last Post: AnotherSam
  [Tkinter] Have tkinter button toggle on and off a continuously running function AnotherSam 5 5,033 Oct-01-2021, 05:00 PM
Last Post: Yoriz
Thumbs Up tkinter canvas; different page sizes on different platforms? philipbergwerf 4 4,147 Mar-27-2021, 05:04 AM
Last Post: deanhystad
  tkinter get function finndude 2 2,967 Mar-02-2021, 03:53 PM
Last Post: finndude
  tkinter -- after() method and return from function -- (python 3) Nick_tkinter 12 7,460 Feb-20-2021, 10:26 PM
Last Post: Nick_tkinter
  function in new window (tkinter) Dale22 7 5,176 Nov-24-2020, 11:28 PM
Last Post: Dale22

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020