Welcome to this tutorial on PySimpleGUI! PySimpleGUI is a Python library that allows you to create simple and easy-to-use graphical user interfaces (GUI) for your Python applications. In this tutorial, we will guide you through the first step of using PySimpleGUI to create your own GUI.
Step 1: Installing PySimpleGUI
The first step to using PySimpleGUI is to install it on your computer. You can install PySimpleGUI using pip, which is the Python package installer. Open your command line interface or terminal and type the following command:
pip install PySimpleGUI
This command will download and install the PySimpleGUI library on your computer. Once the installation is complete, you can start using PySimpleGUI in your Python scripts.
Step 2: Creating a Simple GUI Window
Now that you have installed PySimpleGUI, let’s create a simple GUI window using PySimpleGUI. Open your favorite text editor or Python IDE and create a new Python script. In this script, import the PySimpleGUI library by adding the following line of code:
import PySimpleGUI as sg
Next, create a simple GUI window by adding the following code:
layout = [[sg.Text('Hello, World!')],
[sg.Button('Click Me')]]
window = sg.Window('My First GUI', layout)
while True:
event, values = window.read()
if event == sg.WIN_CLOSED:
break
window.close()
In this code, we create a simple GUI window with a text element that displays "Hello, World!" and a button that says "Click Me". We then create a window using the sg.Window
class and the layout we defined. The while
loop continuously reads events from the window and closes the window if the user clicks the close button.
Step 3: Running Your GUI Application
To run your GUI application, save the Python script you created and run it using your Python interpreter. You should see a GUI window pop up on your screen with the text "Hello, World!" and a button that says "Click Me". Clicking the button will not do anything at this point, as we have not defined any functionality for it.
Congratulations! You have successfully completed the first step of using PySimpleGUI to create a simple GUI window. In the next steps of this tutorial, we will cover more advanced features of PySimpleGUI and show you how to create more complex GUI applications. Stay tuned for the next part of this tutorial!
1:52 где взять такую программочку (PySimpleGUI SDK Quick Reference) ?
измени последовательность видео в этом плэйлисте с 1 по 7, а не как сейчас наоборот, пожалуйста
Я думаю лучше было бы в 1080 записывать видео.
Здравствуйте. Есть ли исходный код к урокам?
Дождаться не могу, ты будоражишь мой моск <3