python asyncioを使用した際GUIが動かなくなる

発生している問題・エラーメッセージ

tkinterを使用してGUIを作成し、Websocket接続ボタンを押すことで、websocket通信を開始させたいのですが、
ボタンを押すと通信は開始されるが、その後、GUIが一切の入力を受け付けなくなってしまいます。
(画面がホワイトアウトし、くるくるが回っている状態)

下記のコードに問題がある点、対処方法を教えて頂きたいです。

よろしくお願いいたします。

class Win2(tk.Frame):   def __init__(self,master):    ~~省略   def create_widgets(self):     self.makeorder_button_connectws = ttk.Button(self.labelFrame, text='Websocket接続',command = self.connect_ws) self.makeorder_button_connectws.pack()   ~~省略   def connect_ws(self):     uri = 'ws://localhost:18080/xxxxxxx/websocket' async with websockets.connect(uri, ping_timeout=None) as ws: while not ws.closed: response = await ws.recv() board = json.loads(response)

コメントを投稿

0 コメント