I want to change the image of the label many times.
But, only the code written in "if, elif" can change the image of the label.
Why does this problem appear? How to fix this problem?
Here is my code:
self.DrawLotsButton.clicked.connect(self.DL)
def DL(self):
awnser = DrawLots.MainLot()
self.qPixmapFileVar = QPixmap()
self.qPixmapFileVar.load("Things/Dugudugu.jpeg") #There is a problem with this part
self.qPixmapFileVar = self.qPixmapFileVar.scaledToWidth(418) #There is a problem with this part
self.qPixmapFileVar = self.qPixmapFileVar.scaledToHeight(475)#There is a problem with this part
self.A_Label.setPixmap(self.qPixmapFileVar)#There is a problem with this part
playsound.playsound("Dugudugu_sound.mp3", False)
time.sleep(3.5)
if awnser == "꽝":
self.qPixmapFileVar = QPixmap()
self.qPixmapFileVar.load("Things/GGwang.png")
self.qPixmapFileVar = self.qPixmapFileVar.scaledToWidth(418)
self.qPixmapFileVar = self.qPixmapFileVar.scaledToHeight(475)
self.A_Label.setPixmap(self.qPixmapFileVar)
elif awnser == "2000원":
self.qPixmapFileVar = QPixmap()
self.qPixmapFileVar.load("Things/2000.png")
self.qPixmapFileVar = self.qPixmapFileVar.scaledToWidth(418)
self.qPixmapFileVar = self.qPixmapFileVar.scaledToHeight(475)
self.A_Label.setPixmap(self.qPixmapFileVar)
elif awnser == "3000원":
self.qPixmapFileVar = QPixmap()
self.qPixmapFileVar.load("Things/3000.png")
self.qPixmapFileVar = self.qPixmapFileVar.scaledToWidth(418)
self.qPixmapFileVar = self.qPixmapFileVar.scaledToHeight(475)
self.A_Label.setPixmap(self.qPixmapFileVar)