blob: 2af5833aa38b8c6ce70538d22716c884b558fd92 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
# Copyright (C) 2022 The Qt Company Ltd.
# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
from __future__ import annotations
"""PySide6 port of the widgets/imageviewer example from Qt v6.0"""
from argparse import ArgumentParser, RawTextHelpFormatter
import sys
from PySide6.QtWidgets import (QApplication)
from imageviewer import ImageViewer
if __name__ == '__main__':
arg_parser = ArgumentParser(description="Image Viewer",
formatter_class=RawTextHelpFormatter)
arg_parser.add_argument('file', type=str, nargs='?', help='Image file')
args = arg_parser.parse_args()
app = QApplication(sys.argv)
image_viewer = ImageViewer()
if args.file and not image_viewer.load_file(args.file):
sys.exit(-1)
image_viewer.show()
sys.exit(app.exec())
|