|
1 | | -# SPDX-License-Identifier: Apache-2.0 |
2 | | -# Copyright 2025 Ague Samuel Amen |
3 | | -# |
4 | | -# Licensed under the Apache License, Version 2.0 (the "License"); |
5 | | -# you may not use this file except in compliance with the License. |
6 | | -# You may obtain a copy of the License at |
7 | | -# |
8 | | -# http://www.apache.org/licenses/LICENSE-2.0 |
9 | | -# |
10 | | -# Unless required by applicable law or agreed to in writing, software |
11 | | -# distributed under the License is distributed on an "AS IS" BASIS, |
12 | | -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
13 | | -# See the License for the specific language governing permissions and |
14 | | -# limitations under the License. |
15 | | - |
16 | | -import sys |
17 | | -from PySide6.QtWidgets import ( |
18 | | - QApplication, |
19 | | - QWidget, |
20 | | - QLabel, |
21 | | - QLineEdit, |
22 | | - QPushButton, |
23 | | - QVBoxLayout, |
24 | | -) |
25 | | - |
26 | | - |
27 | | -class MaFenetre(QWidget): |
28 | | - def __init__(self): |
29 | | - super().__init__() |
30 | | - |
31 | | - self.setWindowTitle("Mon App PySide6") |
32 | | - self.setFixedSize(300, 200) |
33 | | - |
34 | | - # Widgets |
35 | | - self.label = QLabel("Entrez votre nom :") |
36 | | - self.input = QLineEdit() |
37 | | - self.button = QPushButton("Dire Bonjour") |
38 | | - self.output_label = QLabel("") |
39 | | - |
40 | | - # Layout |
41 | | - layout = QVBoxLayout() |
42 | | - layout.addWidget(self.label) |
43 | | - layout.addWidget(self.input) |
44 | | - layout.addWidget(self.button) |
45 | | - layout.addWidget(self.output_label) |
46 | | - self.setLayout(layout) |
47 | | - |
48 | | - # Connexion du bouton |
49 | | - self.button.clicked.connect(self.dire_bonjour) |
50 | | - |
51 | | - def dire_bonjour(self): |
52 | | - nom = self.input.text().strip() |
53 | | - if nom: |
54 | | - self.output_label.setText(f"Bonjour, {nom} !") |
55 | | - else: |
56 | | - self.output_label.setText("Veuillez entrer un nom.") |
| 1 | +#!/usr/bin/env python3 |
| 2 | +# Test workspace entry point |
57 | 3 |
|
| 4 | +def run(): |
| 5 | + return "main_ran" |
58 | 6 |
|
59 | 7 | if __name__ == "__main__": |
60 | | - app = QApplication(sys.argv) |
61 | | - fenetre = MaFenetre() |
62 | | - fenetre.show() |
63 | | - sys.exit(app.exec()) |
| 8 | + print(run()) |
0 commit comments