我有一个函数,在调用时不起作用,而同一缩进中的其他函数完美地工作这是我尝试了很多东西但它们似乎不起作用的函数import tkinter as tk from tkinter import *from tkinter import ttkfrom tkinter.ttk import Progressbarfrom tkinter import messagebox import tkinter.font as font import mysql.connector as mys import time from time import sleep def Assign(): # TE Text Entry # TEfn Text Entry Flight number # TEp Text Entry Passengers # TEa Text Entry Airport # TEd Text Entry Distance def computing(): master=Tk() master.title('AMAS') photo=PhotoImage(file='AMAS.gif') #Image must be GIF Label(image=photo) # Line required to prevent python's garbage dump function Label(master,image=photo,fg='black',bg='black').grid(row=0,column=0,sticky=E) master.resizable(0,0) # Optional line to prevent the user from resizing the window master.mainloop() def dwindow(): print('dwindow called')#TEMP def saveTEd(): global Ed Ed=TEd.get() print(Ed) window.destroy() # Window Number 5 Called Below computing() window=Tk() window.title("Distance") window.configure(background='white') photo1=PhotoImage(file='Distance.gif') Label(image=photo1) Label(window,image=photo1,bg='white').grid(row=0,column=0,sticky=W) Label(window,text='Enter The Distance Travelled',bg='white',fg='black',font='none 12 bold').grid(row=1,column=0,sticky=W) TEd=Entry(window,width=20,bg='white') TEd.grid(row=2,column=0,sticky=W) Button(window,text='Enter',width=6,command=saveTEd).grid(row=3,column=0,sticky=W) mainloop() def awindow(): print('awindow called')#TEMP def saveDDMo(value): global DDMo DDMo=aoption.get() print(DDMo) window.destroy()我认为这可能是因为我正在导入或垃圾转储,但我似乎无法解决问题。我认为这可能是因为我正在导入或垃圾转储,但我似乎无法解决问题。我认为这可能是因为我正在导入或垃圾转储,但我似乎无法解决问题。
1 回答

眼眸繁星
TA贡献1873条经验 获得超9个赞
这里的错误是image "pyimage2" doesn't exist
简而言之,您不能同时运行两个 Tk() 实例,您必须改用 Toplevel()。
添加回答
举报
0/150
提交
取消