I am making a python project,I am using pyqt. The aim is to show a picture (I am using Pixmap) and I want that any column of pixel of this picture go down randomly according to the time. The aim is to create an effect of 'dissolve' the screen.
Here is my code :
#-*- coding: utf-8 -*-
# ---------- Imports ----------
import sys, time, os, random
from PyQt5.QtCore import *
from PyQt5.QtGui import *
from PyQt5.QtWidgets import *
# ---------- Main ----------
class Ui (QMainWindow):
def __init__(self):
QWidget.__init__(self)
# ----- Fichiers -----
folder_path = os.path.dirname(os.path.abspath(__file__))
self.picture_path = str(folder_path + '\\solar_wallpaper.jpg')
self.icon_path = str(folder_path + '\\solar_icon.ico')
# ----- Configuration de la fenêtre -----
self.setWindowFlags(self.windowFlags() &~ Qt.WindowCloseButtonHint)
self.setWindowFlags(self.windowFlags() &~ Qt.WindowMinimizeButtonHint)
self.setWindowFlags(self.windowFlags() &~ Qt.WindowMaximizeButtonHint)
self.setWindowTitle('Solar')
self.setWindowIcon(QIcon(self.icon_path))
self.setStyleSheet("background-color: black;")
# ----- Appel des méthodes -----
self.init_components()
self.init_layout()
self.showFullScreen()
def init_components (self):
self.setCentralWidget(QGroupBox())
self.picture = QLabel(self)
self.picture.setScaledContents(True)
self.picture.setPixmap(QPixmap(self.picture_path))
self.picture.setAlignment(Qt.AlignCenter)
colonne = self.picture.width()
for i in range (colonne):
None
def init_layout (self):
self.layout = QVBoxLayout()
self.layout.addWidget(self.picture)
self.centralWidget().setLayout(self.layout)
# ---------- Launcher ----------
app = QApplication.instance()
if not app :
app = QApplication(sys.argv)
ui = Ui()
app.exec()
A possible solution is to copy and paste pieces of rectangles but with a vertical distance: