如何实现在一个新的窗体中,显示文件中保存的历史记录呢

问题遇到的现象和发生背景

在下拉列表中选择“历史记录”,想开一个新的窗体显示历史计算列式。
思考了很久,只能实现将历史记录存入History2.txt文本文件中,但是无法实现调用到新的窗体中显示。

问题相关代码,请勿粘贴截图
import tkinter as tk
from tkinter import ttk
from tkinter import scrolledtext
import matplotlib.pyplot as plt
import numpy as np

win =tk.Tk()
win.title("计算器")
win.geometry('250x150')

#创建一个计算器方式容器
monty = ttk.LabelFrame(win,text='计算器功能')
monty.grid(column=0, row=0, padx=10, pady=10)

aLabel = ttk.Label(monty, text = 'A label')
ttk.Label(monty,text='请选择一个功能:').grid(column=1,row=0)

# 按钮的方法

def clickMe():
     action.configure(text=combobox.get())
     if combobox.get()=='按钮计算':
       win2 =tk.Tk()
       win2.geometry('320x530')
       win2.title('按钮计算')
       win2.geometry('410x380')
#输入
       e='' 
       def add(n):
           nonlocal e
           e += n
           Label_result.config(text = e)
           f1 = open('E:\History2.txt', "a+")    #a+的意思是继续追加写入数据,不清空。
           f1.write(n)
           f1.close()
#清除
       def clear():
           nonlocal e
           e = ''
           Label_result.config(text = e)

#计算
       def calculate():
           nonlocal e
           result = ''
           if e != '':
               try:
                   result = eval(e)
               except:
                   result = 'error'
                   e = ''
           Label_result.config(text = result)
           #存记录
           f1 = open('E:\History2.txt', "a+")    #a+的意思是继续追加写入数据,不清空。
           f1.write('=')
           f1.write(str(result))
           f1.write('\n')
           f1.close()

#显示算式和答案
       Label_result = tk.Label(win2,text = '',bg='white')
       Label_result.place(x = 2,y=10,width = 398,height = 40)
       
       #键盘
       btn7 = tk.Button(win2,text = '7',font=('宋体',16),command = lambda:add('7'))
       btn7.place(x = 100*0,y = 60*0+60,width = 100,height = 60)
       btn8 = tk.Button(win2,text = '8',font=('宋体',16),command = lambda:add('8'))
       btn8.place(x = 100*1,y = 60*0+60,width = 100,height = 60)
       btn9 = tk.Button(win2,text = '9',font=('宋体',16),command = lambda:add('9'))
       btn9.place(x = 100*2,y = 60*0+60,width = 100,height = 60)
       btnadd = tk.Button(win2,text = '+',font=('宋体',16),command = lambda:add('+'))
       btnadd.place(x = 100*3,y = 60*0+60,width = 100,height = 60)

       btn4 = tk.Button(win2,text = '4',font=('宋体',16),command = lambda:add('4'))
       btn4.place(x = 100*0,y = 60*1+60,width = 100,height = 60)
       btn5 = tk.Button(win2,text = '5',font=('宋体',16),command = lambda:add('5'))
       btn5.place(x = 100*1,y = 60*1+60,width = 100,height = 60)
       btn6 = tk.Button(win2,text = '6',font=('宋体',16),command = lambda:add('6'))
       btn6.place(x = 100*2,y = 60*1+60,width = 100,height = 60)
       btnjian = tk.Button(win2,text = '-',font=('宋体',16),command = lambda:add('-'))
       btnjian.place(x = 100*3,y = 60*1+60,width = 100,height = 60)
    
       btn1 = tk.Button(win2,text = '1',font=('宋体',16),command = lambda:add('1'))
       btn1.place(x = 100*0,y = 60*2+60,width = 100,height = 60)
       btn2 = tk.Button(win2,text = '2',font=('宋体',16),command = lambda:add('2'))
       btn2.place(x = 100*1,y = 60*2+60,width = 100,height = 60)
       btn3 = tk.Button(win2,text = '3',font=('宋体',16),command = lambda:add('3'))
       btn3.place(x = 100*2,y = 60*2+60,width = 100,height = 60)
       btnx = tk.Button(win2,text = '*',font=('宋体',16),command = lambda:add('*'))
       btnx.place(x = 100*3,y = 60*2+60,width = 100,height = 60)

       btno = tk.Button(win2,text = '.',font=('宋体',16),command = lambda:add('.'))
       btno.place(x = 100*0,y = 60*3+60,width = 100,height = 60)
       btn0 = tk.Button(win2,text = '0',font=('宋体',16),command = lambda:add('0'))
       btn0.place(x = 100*1,y = 60*3+60,width = 100,height = 60)
       btnch = tk.Button(win2,text = '%',font=('宋体',16),command = lambda:add('%'))
       btnch.place(x = 100*2,y = 60*3+60,width = 100,height = 60)
       btnchu = tk.Button(win2,text = '/',font=('宋体',16),command = lambda:add('/'))
       btnchu.place(x = 100*3,y = 60*3+60,width = 100,height = 60)

       btnd = tk.Button(win2,text = '=',font=('宋体',16),command = lambda:calculate())
       btnd.place(x = 100*0,y = 60*4+60,width = 100*3,height = 60)
       btnc = tk.Button(win2,text = 'C',font=('宋体',16),command = lambda:clear())
       btnc.place(x = 100*3,y = 60*4+60,width = 100,height = 60)
       win2.mainloop()
       
       
     if combobox.get()=='函数图像':
       win3 =tk.Tk()
       win3.geometry('401x185')
       win3.title('函数图像')


#sin图函数
       def draw1():
           x=np.arange(-np.pi,np.pi,0.1)
           y=np.sin(x)
           plt.plot(x,y)
           plt.show()
    
#cosx图函数
       def draw2():
           x=np.arange(-np.pi,np.pi,0.1)
           y=np.cos(x)
           plt.plot(x,y)
           plt.show()
#sin和cos的按钮
       btns = tk.Button(win3,text = 'sinx',font=('宋体',16),command = lambda:draw1())
       btns.place(x = 100*0,y = 60*0+60,width = 200,height = 120)

       btnc = tk.Button(win3,text = 'cosx',font=('宋体',16),command = lambda:draw2())
       btnc.place(x = 100*2,y = 60*0+60,width = 200,height = 120)       
       win3.mainloop()
  
if combobox.get()=='历史记录':
       win4 =tk.Tk()
       win4.geometry('320x530')
       win4.title('历史记录')
      
    #显示历史
       f2 = open('E:\History2.txt', 'r')
       str1 = f2.read()
       result.set(str1)
       f2.close()
       def pressls():
           f1=open("E:\History2.txt","r")
           str=f1.read()
           output=tk.Text(win4)
           output.place(width =320,height = 530)
           output.insert('end',str)
           Label_result = tk.Label(win2,text = '',bg='white')
           Label_result.place(x = 2,y=10,width = 398,height = 40)
           win4.mainloop()

#按钮
action= ttk.Button(monty,text='点击我',command =clickMe)
action.grid(column = 2, row=1)



#创建一个下拉列表
var = tk.StringVar()
combobox = tk.ttk.Combobox(monty,width=12,textvariable=var,state='readonly')
combobox['values'] = ('按钮计算','历史记录','函数图像')
combobox.grid(column=1,row=1)
combobox.current(0)

#滚动文本框
scrolW = 30
scrolH = 3
scr = scrolledtext.ScrolledText(monty,width=scrolW,height=scrolH)
scr.grid(column=0,columnspan=3)
win.mainloop()

很感激您能耐心看到这里,期待您的回复,感谢~

我想要达到的结果

问题重复啦?
参考这个,用 toplevel

from tkinter import *
root = Tk()
root.geometry('600x500')
root.title ("主窗口")
btn = Button(root)
btn['text']="查看历史"
btn.pack()
def click():  # 定义事件函数
    tl = Toplevel()
    tl.title("查看")
    tl.geometry('200x400')
    # 这里加你的显示文件代码
    Label(tl, text='修改历史').pack()
btn['command'] = click
root.mainloop()