'I get an error when combining telethon and tkinter
I was trying to make a mixed application with tkinter and telethon, but it gives an error, it should work as logic, but I could not find where the problem is.
here is the code
from tkinter import *
from telethon import events, utils, TelegramClient
import asyncio
window = Tk()
window.geometry('600x600')
window.title("###")
api_id = ###########3
api_hash = '###'
client = TelegramClient('anon', api_id, api_hash)
async def main():
await client.send_message("me", f'hi')
await asyncio.sleep(delay=1)
asyncio.run(main())
butonq = Button(text="click", fg="black", bg = "white", command=main)
butonq.pack()
window.mainloop()
Logically it should work but I get an error like this
C:\Users\yegen\AppData\Local\Programs\Python\Python39\lib\tkinter\__init__.py:1429: RuntimeWarning: coroutine 'main' was never awaited
self.tk.mainloop(n)
RuntimeWarning: Enable tracemalloc to get the object allocation traceback
Can you help me solve the problem?. Thanks
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
