Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

how can I put the received message to GUI? #149

Open
zingshowba opened this issue Feb 23, 2022 · 1 comment
Open

how can I put the received message to GUI? #149

zingshowba opened this issue Feb 23, 2022 · 1 comment

Comments

@zingshowba
Copy link

I'm a python probie, I'm trying to put the message that I send from my phone to GUI, or use the message as an order to execute some command. But I CANT get the message out, please help me out.

import PySimpleGUI as sg
from pythonosc.dispatcher import Dispatcher
from pythonosc.osc_server import BlockingOSCUDPServer

ip = "192.168.0.108"
port = 1337

def print_handler(address, *args):
print(f"{address}: {args}")

def default_handler(address, *args):
print(f"DEFAULT {address}: {args}")
print(f":{args}")

dispatcher = Dispatcher()
dispatcher.map("/something/*", print_handler)
dispatcher.set_default_handler(default_handler)

trying to get the msg and print it out But it didn't work

msg = dispatcher.set_default_handler(print_handler)

print(f"testing{msg}")

server = BlockingOSCUDPServer((ip, port), dispatcher)

server.serve_forever()

layout = [[sg.Text('MetaBorder')],
[sg.Text(size=(20,1), font= "Any 15", key="-OUT-")],
[sg.Button("获取数据"), sg.Button("退出")]
]

window = sg.Window("Metaborder", layout, keep_on_top=True)

while True:
event, values = window.read(timeout=1000)
if event is None or event == "退出":
break
window["-OUT-"].update(msg)

window.close()

@rizaru22
Copy link

have you found the way to put OSC message to Label (GUI) ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants