Сообщение об ошибке:
File "C:\Users\think\PycharmProjects\network_monitor\Untar_DDC.py", line 16, in untar_file
notice.display_message("11untar_file : " + untar_filename + untar_location)
File "C:\Users\think\PycharmProjects\network_monitor\monitor.py", line 469, in display_message
self.dis_message.setText(message)
AttributeError: 'Ui_MainWindow' object has no attribute 'dis_message'
-
# Untar_DDC.py
import os
import sys
import tarfile
from monitor import Ui_MainWindow
class Untar_DDC:
def untar_file(self, untar_filename, untar_location):
notice = Ui_MainWindow()
notice.display_message("11untar_file : " + untar_filename + untar_location)
-
# monitor.py
from PyQt5 import QtCore, QtGui, QtWidgets
class Ui_MainWindow(object):
def setupUi(self, MainWindow):
MainWindow.setObjectName("MainWindow")
self.dis_message = QtWidgets.QTextBrowser(self.splitter)
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Preferred)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.dis_message.sizePolicy().hasHeightForWidth())
self.dis_message.setSizePolicy(sizePolicy)
self.dis_message.setObjectName("dis_message")
def display_message(self,message):
self.dis_message.setText(message)