Dec-18-2017, 10:32 PM
I am looking to porting my python code to PyQt but I don't understand how to "Print()" to a text window. a print fragment of my code is below and it produces this simple user interface screen that I would like to see in a PyQt window instead.
class Start_Up_Display(object):
def __init__(self):
pass
def start(self):
global message
print("\nSWITCH STATUS REPORT")
print("-------------")
num = 0
while num < len(Sw)-1:
screen.show_all_in_line(num)
num = num +1
screen.show_all_in_line(num)
num = 0
if len(message)!= 0:
print("\nMessage: [%s]" % message)
else:
print("\nMessage: ")
message = ''
class Display_Switch(object):
def __init__(self):
pass
def show_all_in_line(self, abb):
print("%s %s %s %s \t@ %s" % ( Sw[int(abb)][0].ljust(3),
Sw[int(abb)][3].ljust(3),
chr(int(Sw[int(abb)][4])),
Sw[int(abb)][1].ljust(14),
Sw[int(abb)][2].ljust(41))
)
Result:
[Image: MRSM.jpg]
class Start_Up_Display(object):
def __init__(self):
pass
def start(self):
global message
print("\nSWITCH STATUS REPORT")
print("-------------")
num = 0
while num < len(Sw)-1:
screen.show_all_in_line(num)
num = num +1
screen.show_all_in_line(num)
num = 0
if len(message)!= 0:
print("\nMessage: [%s]" % message)
else:
print("\nMessage: ")
message = ''
class Display_Switch(object):
def __init__(self):
pass
def show_all_in_line(self, abb):
print("%s %s %s %s \t@ %s" % ( Sw[int(abb)][0].ljust(3),
Sw[int(abb)][3].ljust(3),
chr(int(Sw[int(abb)][4])),
Sw[int(abb)][1].ljust(14),
Sw[int(abb)][2].ljust(41))
)
Result:
[Image: MRSM.jpg]