Show results of Jupyterlab on Tkinter UI

Viewed 16

I am currently working on building an UI to show the images in my JupyterLab to my Tkinter UI, that is running on a same script. In my script, I hope that after entering the values in Tkinter, it will take in the input and run again, and show the image on Tkinter UI again, so that I can do try and error. Can anyone guide me or give me a little tips to know where to find the answer and how to work on it?

from tk import *
from tkinter import ttk
from PIL import ImageTk, Image
import tkinter as tk
import os
window = tk.Tk()

def show_result(a,b,c,d):
    #display the image result
    #run the again to test the result
    
x1 = tk.IntVar()
x2 = tk.IntVar()
y1 = tk.IntVar()
y2 = tk.IntVar()

# set textbox to capture variables 
x1_value = ttk.Entry(textvariable=x1).place(x=50, y=50)
x2_value = ttk.Entry(textvariable=x2).place(x=50, y=100)
y1_value = ttk.Entry(textvariable=y1).place(x=50, y=150)
y2_value = ttk.Entry(textvariable=y2).place(x=50, y=200)
    
display_button = ttk.Button(text="Run", command= lambda: show_result(x1.get(),x2.get(),y1.get(),y2.get())).place(x=50, y=300)

window.geometry("900x750")
window.mainloop( )
0 Answers
Related