1

Topic: How from other unit to address to Python?

There is a form made in pygt5 and on it is textEdit.
By operation of connected function from the unit to the form in textEdit wanted to transfer the text;
But how to transfer parameters from the unit in  pygt, how to address to it??
main.py

import sys
from main_form import *
from work import *
from PyQt5 import QtCore, QtGui, QtWidgets
class MyWin (QtWidgets. QMainWindow):
def __ init __ (self, parent=None):
QtWidgets. QWidget. __ init __ (self, parent)
self.ui = Ui_MainWindow ()
self.ui.setupUi (self)
self.ui.lineEdit.setPlaceholderText ("The Example: 2018")
self.ui.lineEdit_2.setPlaceholderText ("The Example: 07")
self.ui.pushButton.clicked.connect (self. Check)
self.show ()
def Check (self):
year = self.ui.lineEdit.text ()
month = self.ui.lineEdit_2.text ()
extract (self, dir, year, month)
if __ name __ == "__ main __":
app = QtWidgets. QApplication (sys.argv)
myapp = MyWin ()
myapp.show ()
sys.exit (app.exec _ ())

work.py

import zipfile
import timeit
import os
def extract (self, dir, year, month):
if os.listdir (dir):
for file in os.listdir (dir):
if os.path.isfile (dir+file):
time_start = timeit.default_timer ()
with zipfile. ZipFile (dir + file, ' r ') as zfile:
zfile.extractall (path ='C: \\txt \\1 \\')
zfile.close ()
tm_wr = str (timeit.default_timer () - time_start)
self.ui.textEdit.setText (tmp_zip + ' handling time: ' + tm_wr [0: 5])
# In this place I want to send in  lines about the different information of handling of a file.

But the given variant does not work, how from this script to address to any  and to transfer/change something at it???

2

Re: How from other unit to address to Python?

tem wrote:

but the given variant does not work

In what it is shown? How as image does not work?

3

Re: How from other unit to address to Python?

NekZ wrote:

it is passed...
In what it is shown? How as image does not work?

Generally it is deduced nothing in textEdit and the error is not present, thought not correctly I address to ...

4

Re: How from other unit to address to Python?

tem@;
Try to deduce in self.ui.lineEdit which at you figures in MyWin. __ init __,  eventually.

5

Re: How from other unit to address to Python?

NekZ;
Business in a cycle while the cycle is twisted in  nothing is deduced, if a cycle to interrupt that all at once in textEdit appears!
And the program should be permanently triggered, . files appear in a folder permanently and they should be processed, and for users wanted to make that was conveniently displayed  what file processed and . It turns out there is no method except how to deduce the data in ? :-((

6

Re: How from other unit to address to Python?

tem@;
And, all understood. In a cycle cause

QApplication.instance ().processEvents ()

7

Re: How from other unit to address to Python?

NekZ;
Thanks, work, that is necessary!!!