
Рівень 2-3 (3-9 балів) Створити вікно з характеристиками на Ваш вибір. Створити три різних кнопки
з назвами «Принтер», «Сканер», «Клавіатура».I вiдповiдно три написи з характеристиками пристроїв ПК.Умова - щоб при натисненні на кнопку з'являвся відповідний напис.

Ответы на вопрос

import tkinter as tk
root = tk.Tk()
root.geometry("1000x600")
lb1 = tk.Label(master = root, text = "above 3000 piece of papers!")
lb2 = tk.Label(master = root, text = "above 4000px per sm!")
lb3 = tk.Label(master = root, text = "100 butons)")
btt1 = tk.Button(master=root, text="Принтер", command=lambda: lb1.pack()).pack()
btt2 = tk.Button(master=root, text="Сканер", command=lambda: lb2.pack()).pack()
btt3 = tk.Button(master=root, text="Клавіатура", command=lambda: lb3.pack()).pack()
root.mainloop()



To create a window with characteristics and three different buttons named "Printer," "Scanner," and "Keyboard," along with corresponding labels for the PC devices, you can use a graphical user interface (GUI) library like Tkinter in Python. Here's an example of how you can achieve this:
```python import tkinter as tk
def show_printer(): label.config(text="Printer: [characteristics]")
def show_scanner(): label.config(text="Scanner: [characteristics]")
def show_keyboard(): label.config(text="Keyboard: [characteristics]")
# Create the main window window = tk.Tk()
# Create the label to display the characteristics label = tk.Label(window, text="Click a button to see the device characteristics") label.pack()
# Create the buttons printer_button = tk.Button(window, text="Printer", command=show_printer) printer_button.pack()
scanner_button = tk.Button(window, text="Scanner", command=show_scanner) scanner_button.pack()
keyboard_button = tk.Button(window, text="Keyboard", command=show_keyboard) keyboard_button.pack()
# Start the main event loop window.mainloop() ```
In this example, we import the `tkinter` module and define three functions (`show_printer()`, `show_scanner()`, and `show_keyboard()`) that will be called when the corresponding button is clicked. Each function updates the label's text with the characteristics of the respective device.
We then create the main window using `tk.Tk()`, create a label to display the characteristics, and pack it into the window. Next, we create the three buttons, specifying their text and the corresponding function to call when clicked. Finally, we start the main event loop using `window.mainloop()` to handle user interactions.
When you run this code, a window will appear with the label "Click a button to see the device characteristics" and three buttons labeled "Printer," "Scanner," and "Keyboard." When you click any of the buttons, the label will update with the corresponding device's characteristics.
Please note that this example assumes you have Python and the Tkinter library installed on your system. If you don't have them installed, you can refer to the official Python documentation or relevant online resources for installation instructions.
I hope this helps! Let me know if you have any further questions.


Похожие вопросы

Топ вопросов за вчера в категории Информатика







Последние заданные вопросы в категории Информатика
-
Математика
-
Литература
-
Алгебра
-
Русский язык
-
Геометрия
-
Английский язык
-
Химия
-
Физика
-
Биология
-
Другие предметы
-
История
-
Обществознание
-
Окружающий мир
-
География
-
Українська мова
-
Информатика
-
Українська література
-
Қазақ тiлi
-
Экономика
-
Музыка
-
Право
-
Беларуская мова
-
Французский язык
-
Немецкий язык
-
МХК
-
ОБЖ
-
Психология
-
Физкультура и спорт
-
Астрономия
-
Кыргыз тили
-
Оʻzbek tili