C:\Users\User\Desktop>test.exe
Traceback (most recent call last):
File "test.py", line 5, in <module>
exec('from ' + str(fold) + ' import ' + str(mod))
File "<string>", line 1, in <module>
ModuleNotFoundError: No module named 'file'
[6032] Failed to execute script test
AttributeError: 'Ui_Form' object has no attribute 'grab'
from PyQt5 import QtCore, QtGui, QtWidgets
class Ui_Form(object):
def setupUi(self, Form):
Form.setObjectName("Form")
Form.resize(522, 185)
self.pushButton = QtWidgets.QPushButton(Form)
self.pushButton.setGeometry(QtCore.QRect(20, 100, 481, 71))
self.pushButton.setObjectName("pushButton")
self.lineEdit = QtWidgets.QLineEdit(Form)
self.lineEdit.setGeometry(QtCore.QRect(20, 20, 481, 71))
self.lineEdit.setObjectName("lineEdit")
self.retranslateUi(Form)
QtCore.QMetaObject.connectSlotsByName(Form)
def retranslateUi(self, Form):
_translate = QtCore.QCoreApplication.translate
Form.setWindowTitle(_translate("Form", "Form"))
self.pushButton.setText(_translate("Form", "Screenshot"))
from PyQt5 import QtCore, QtGui, QtWidgets, uic
import sys
from file import Ui_Form
import os
app = QtWidgets.QApplication(sys.argv)
Form = QtWidgets.QWidget()
ui = Ui_Form()
ui.setupUi(Form)
Form.show()
def buttonHandler(self):
ui.grab().save('save.png', 'png')
os.startfile('image.png')
print('END')
ui.pushButton.clicked.connect( buttonHandler )
sys.exit(app.exec_())
from multiprocessing import Process
def func1(message):
time.sleep(5)
bot.send_message(message.chat.id, '1 - Функция.')
def func2(message):
time.sleep(5)
bot.send_message(message.chat.id, '2 - Функция.')
if __name__=='__main__':
p1 = Process(target = func1)
p1.start()
p2 = Process(target = func2)
p2.start()