I am creating a UI and after I click the widget button the next Tkinter should be permanent. In this permanent Tkinter window, I need to click a hardware button for other purposes like capture an image. This is the image of my UI UI then after clicking the "Click here button another UI will show up like this Next UI. How do I keep this next UI and use a hardware push button to update the text label? This is the code I have done so far for this UI.
if __name__ == '__main__':
root = tk.Tk()
root.geometry("480x320")
root['bg']='white'
PlayerTwo=PhotoImage(file="2.png")
PlayerThree=PhotoImage(file="3.png")
PlayerFour=PhotoImage(file="4.png")
players_label = tk.Label(root,
text="CHOOSE THE NUMBER OF PLAYERS THAT WILL BE PLAYING",
font="Times 13",
fg="white",
bg="#85C1E9")
players_label.pack(fill=X,ipady=40)
#No. of players and button for players name
b0 = tk.Button(root, text="Click here after player credentials", command=determine_players)
b0.pack(fill=X, ipady=20)
root.mainloop()
And this code is after clicking the UI widget button
def determine_players():
top = tk.Tk()
top.geometry("480x320")
text_file = open("players.txt", "r")
message = text_file.read()
players = message.split()
point1 = 0
point2 = 1
#print(players)
if len(players) == 2:
proc = ImageProcess()
img = cv2.imread("array_try/Character_extract_image1.jpg")
print(proc.frame_table(img))
Player1 = players[0]
Player2 = players[1]
player1 = tk.Label(top,
text=Player1,
font="Times 45",
fg="white",
bg="#0000FF")
#player1.pack(side='left', padx=10, pady=10, anchor= N)
player1.grid(row=0, column=0)
player1.config(width=7)
text1 = tk.Text(top, heigh=30, width=30)
pickle_in = open("game_file.pickle","rb")
example_dict = pickle.load(pickle_in)
text1.insert(tk.INSERT,example_dict[point1])
text1.grid(column=0, row=1, sticky='N')
It would be greatly appreciated if someone could help me with this. Thank you.