Skip to content

Commit 0d20780

Browse files
committed
feat(gui-base64): add PyQt6 compatibility
1 parent d4c847d commit 0d20780

1 file changed

Lines changed: 17 additions & 8 deletions

File tree

‎Base64_examples/gui_base64.py‎

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,17 +11,26 @@
1111
from os.path import split as path_split
1212

1313
try:
14-
from PyQt5.QtWidgets import *
15-
from PyQt5.QtCore import *
14+
from PyQt6.QtWidgets import *
15+
from PyQt6.QtCore import *
16+
17+
QSizePolicy.Expanding = QSizePolicy.Policy.Expanding
18+
QSizePolicy.Preferred = QSizePolicy.Policy.Preferred
19+
Qt.TextSelectableByMouse = Qt.TextInteractionFlag.TextSelectableByMouse
1620

1721
except:
1822
try:
19-
from PyQt4.QtGui import *
20-
from PyQt4.QtCore import *
23+
from PyQt5.QtWidgets import *
24+
from PyQt5.QtCore import *
2125

2226
except:
23-
from PySide.QtGui import *
24-
from PySide.QtCore import *
27+
try:
28+
from PyQt4.QtGui import *
29+
from PyQt4.QtCore import *
30+
31+
except:
32+
from PySide.QtGui import *
33+
from PySide.QtCore import *
2534

2635

2736
def log_uncaught_exceptions(ex_cls, ex, tb) -> None:
@@ -266,10 +275,10 @@ def change_convert_direct(self) -> None:
266275

267276

268277
if __name__ == "__main__":
269-
app = QApplication([])
278+
app = QApplication(sys.argv)
270279

271280
mw = MainWindow()
272281
mw.resize(650, 500)
273282
mw.show()
274283

275-
sys.exit(app.exec_())
284+
sys.exit(app.exec())

0 commit comments

Comments
 (0)