Created
September 27, 2022 21:40
-
-
Save hannesdelbeke/de3d8d87521ba635b6abd78112ef96bc to your computer and use it in GitHub Desktop.
non blocking example tkinter python UI in unreal engine 5
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from tkinter import * | |
import unreal | |
# non blocking example of tkinter, which ships with unreal | |
def show(): | |
window = Tk() | |
window.title("TKinter test") | |
window.geometry('350x200') | |
def clicked(): | |
lbl.configure(text="Button was clicked !!") | |
lbl = Label(window, text="Hello") | |
lbl.grid(column=0, row=0) | |
btn = Button(window, text="Click Me", command=clicked) | |
btn.grid(column=1, row=0) | |
unreal.parent_external_window_to_slate(window.winfo_id()) | |
def update(*args, **kwargs): | |
window.update_idletasks() | |
window.update() | |
tick_handle = unreal.register_slate_post_tick_callback(update) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment