Answer the question
In order to leave comments, you need to log in
How can I add my infinite loop to the Python program code from the telebot telegram bot (telebot) library in Python (Python)?
You need to create an infinite loop to check events,
well, of course I can create an infinite loop, but it slows down the bot, but it is necessary that if the events are correct, the bot sends a message, but continues to work...
from PyQt5 import QtWidgets
# Импортируем наш шаблон.
from myform import Ui_MainWindow
import sys
class mywindow(QtWidgets.QMainWindow):
def __init__(self):
super(mywindow, self).__init__()
self.ui = Ui_MainWindow()
self.ui.setupUi(self)
# подключение клик-сигнал к слоту btnClicked
self.ui.pushButton.clicked.connect(self.btnClicked)
def btnClicked(self):
self.ui.label.setText("Вы нажали на кнопку!")
# Если не использовать, то часть текста исчезнет.
self.ui.label.adjustSize()
app = QtWidgets.QApplication([])
application = mywindow()
application.show()
app.exec()
Answer the question
In order to leave comments, you need to log in
Excuse me, but what does the telebot have to do with it? And so it can be done with multithreading.
Instead of a loop, make a timer event like this: https://stackoverflow.com/questions/41327545/how-t...
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question