I’m working on a shopping cart GUI. I have a list called my_order, which stores the information I get from the user. I want to update label text in a for loop so I can print all the elements of my_order list. Here’s my code:
class PaymentScreen(QMainWindow):
def __init__(self):
super(PaymentScreen, self).__init__()
loadUi("paymentscreen.ui",self)
self.gobackbutton.clicked.connect(self.goback)
self.basket.setText("{}".format(my_order)) #the output looks like ["burger","fries"] and I dont want that
I’m trying to print all the elements one under the another instead of that list view. I looked for the similar cases but couldn’t find the solution.
I want the output to look like this:
burger
fries
How can I do that?
I want to update label text
>Solution :
I am no expert in Python GUI but i am good in python programming and I assume you want the string inside setText to be a multiline string. I could help with that.
You can use something line this:
self.basket.setText("\n".join(my_order))