I have no idea how to create a Gui from another Gui using python. What I have so far is simply a basic Gui which you select one of the options from a dropdown menu and create another Gui. Here's what I have so far...
import sys
from tkinter import *
#def m
forces = []
def mCalculate():
mtext = mass.get()
mtext2 = acceleration.get()
mlabel = Label(mGui,text = mtext * mtext2).pack()
forces.append(mCalculate)
return
def mGraph():
messagebox.showinfo(title="Graphs",message="Graph option 1")
return
def secondGui Tk():
secondGui.title('Second Gui')
button = Button(text = 'Graph these points', command = mGraph).pack()
def mGraphAction():
mPoints = forces
mGui = Tk()
mass = DoubleVar()
acceleration = DoubleVar()
mGui.geometry('650x550+500+500')
mGui.title('Simple Newton Gui')
menubar = Menu (mGui)
graphmenu = Menu (mGui)
filemenu = Menu(menubar)
filemenu.add_command(label="First Gui option"""", command = secondGui""")
filemenu.add_command(label="Second Gui option")
filemenu.add_command(label="Third Gui option")
filemenu.add_command(label="Fourth Gui option")
menubar.add_cascade(label="Gui sub menus",menu = filemenu)
graphmenu.add_command(label="Graph this as a slope!",command = mGraphAction)
graphmenu.add_command(label="Graph Gui",command = secondGui)
graphmenu.add_command(label="Third Graph option")
graphmenu.add_command(label="Fourth Graph option")
menubar.add_cascade(label="Graph options",menu = graphmenu)
mGui.config(menu=menubar)
mlabel = Label(text='Input the Mass please.', fg='red').pack()
mEntry = Entry(mGui,textvariable=mass).pack()
mlabel = Label(text='Inupt the Acceleration please.', fg='red').pack()
mEntry2 = Entry(mGui, textvariable=acceleration).pack()
mbutton = Button(text = 'Calculate',command = mCalculate).pack()
I'm not sure how to define the second Gui, also while I'm here, I would like to take the output from the two inputs and append it into a list where every time the user clicks 'Calculate', you would get number++ ie. user input 12.5, user input 2.0, output = 25.0... [1, 25.0] then another input of 13.5, input 2.0, ouput 27.0... [1,25.0,2,27.0] etc. I would like to know if this kind of appending is possible, or if there's a better way to do it.