Learn Python Graphical User Interface: PyQt5 | Hadi Youness | Skillshare
Drawer
Search

Playback Speed


  • 0.5x
  • 1x (Normal)
  • 1.25x
  • 1.5x
  • 2x

Learn Python Graphical User Interface: PyQt5

teacher avatar Hadi Youness, Computer Engineer

Watch this class and thousands more

Get unlimited access to every class
Taught by industry leaders & working professionals
Topics include illustration, design, photography, and more

Watch this class and thousands more

Get unlimited access to every class
Taught by industry leaders & working professionals
Topics include illustration, design, photography, and more

Lessons in This Class

    • 1.

      Introduction

      2:54

    • 2.

      Requirements

      1:39

    • 3.

      PyQt5 Version

      3:43

    • 4.

      3Date & Time

      8:35

    • 5.

      Buttons

      7:33

    • 6.

      Layout

      14:25

    • 7.

      Form Layout

      10:28

    • 8.

      Label

      6:06

    • 9.

      Line Edit

      9:13

    • 10.

      Radio Button

      10:02

    • 11.

      Check Box

      7:30

    • 12.

      Combo Box

      5:55

    • 13.

      Spin Box

      5:00

    • 14.

      Slider

      13:36

    • 15.

      Menu Bar

      8:13

    • 16.

      Tool Bar

      6:26

    • 17.

      Input Dialog

      12:53

    • 18.

      Font Dialog

      6:41

    • 19.

      File Dialog

      13:11

    • 20.

      Tab

      10:46

    • 21.

      Stack

      10:50

    • 22.

      Splitter

      7:31

    • 23.

      Dock

      6:25

    • 24.

      Scroll Bar

      5:51

    • 25.

      Status Bar

      7:55

    • 26.

      Calendar

      5:39

    • 27.

      Drag & Drop

      12:54

    • 28.

      Qt Designer Download

      2:11

    • 29.

      Introduction To Qt Designer

      5:34

    • 30.

      Widget Box

      11:33

    • 31.

      Qt Designer First Application

      7:34

    • 32.

      Convert Ui To Python

      3:05

    • 33.

      Layout In Qt Designer

      7:58

    • 34.

      Edit Tab Order

      4:16

    • 35.

      Defining Buddies

      3:03

    • 36.

      Edit Slots & Signals

      5:53

    • 37.

      Dice Game Introduction

      3:41

    • 38.

      Dice Game: Building Application

      8:34

    • 39.

      Dice Game: Adding Players

      9:22

    • 40.

      Dice Game: Score And Dices

      11:26

    • 41.

      Dice Game: Hold And Roll Buttons

      4:26

    • 42.

      Dice Game: Roll The Dice Button

      14:58

    • 43.

      Dice Game: Hold, New Game And Winner Buttons

      14:14

    • 44.

      Project

      1:49

  • --
  • Beginner level
  • Intermediate level
  • Advanced level
  • All levels

Community Generated

The level is determined by a majority opinion of students who have reviewed this class. The teacher's recommendation is shown until at least 5 student responses are collected.

142

Students

--

Projects

About This Class

In this course, you are going to learn about python's most famous graphical user interface: PyQt5.

We are going to follow the following outline: 

-First, we are going to learn about the basic widget of PyQt5 such as the layout, label, buttons, bars, and much more.

-Second, we are going to move into some advanced widgets and topics such as input, font, and file dialog, stacks, tabs, and splitters.

-Then, we are going to learn about PyQt's famous tool "Qt Designer" which is going to allow to the creation of an application using the drag and drop technique. We will have a detailed walkthrough of all of the features of this tool to be able to build any application smoothly.

-Finally, we are going to have a list of projects that will be always updated. The projects list contains: 

1-Dice Game: Build a Dice Game Using PyQt5 widgets and learn how to connect different functions to their corresponding buttons. In addition, you are going to learn how to use CSS in PyQt5 to improve the user's overall experience in your GUI applications.

More projects will be added on a regular basis.

I hope you enjoy this course, and I would like to add that I will be available anytime throughout your journey in this course, and if you have any questions, concerns, or feedback, I will be happy to hear and answer them! 

Meet Your Teacher

Teacher Profile Image

Hadi Youness

Computer Engineer

Teacher

Hello, I'm Hadi. I am studying Computer Engineering at the Lebanese American University (LAU). I like to share my knowledge with everybody and I believe that teaching is a perfect way to understand anything since you must be well informed about something to be able to teach it in the simplest possible ways!

See full profile

Level: Beginner

Class Ratings

Expectations Met?
    Exceeded!
  • 0%
  • Yes
  • 0%
  • Somewhat
  • 0%
  • Not really
  • 0%

Why Join Skillshare?

Take award-winning Skillshare Original Classes

Each class has short lessons, hands-on projects

Your membership supports Skillshare teachers

Learn From Anywhere

Take classes on the go with the Skillshare app. Stream or download to watch on the plane, the subway, or wherever you learn best.

Transcripts

1. Introduction : Hello and welcome. My name is head units and that will be structured throughout this course. Now today we're going to talk about one of the most famous Python graphical user interface, and it is known as Pi purified. So we do have five versions now. And this is the fifth one that we're going to use in this course. And before starting, I would like to give you a little outline of what you should expect from this course and in what ways it will improve your knowledge in this domain. So first of all, we're going to start with the basic widgets that we have in Piketty five. And then we're gonna move on to advanced ones asset that we're going to talk about the QT designer tool. And this is one of the most famous tours that uses the DAC and drop technique to create the applications. And finally, we're going to create some projects and applications. What we've learned earlier. Now starting with the basic widgets, we're going to cover a wide range of them, such as buttons, layout, labels, the line and tax edit, push, radio and check buttons. And we do have many more that we're going to cover. And after that, we're going to move on to the advanced ones, such as the combo box, spin box, slider, menu and Toolbar. And we do have the input font and five dialogues. And after that, we're going to talk about the tab stack sputter and so on. So it will have many more advanced stages that we're going to cover. And after that, we're going to talk about the QT designer tool. We're going to learn how to download it. And then we're going to have a walk-through through all the main functions that we're going to use. It. After that, we're going to take the main basic and advanced switches that we've learned earlier and learn how to use them in this tool. Then we're going to learn how to connect buttons with other widgets inside the stool with a drag and drop technique and simply linking between the buttons and widgets inside the application. And finally, we're going to create haul applications using this tool. And with that being said, we'll be having two main ways to create our Piketty five applications. The first one is with the writing the code yourself and decided one is by using this QT designer tool. And usually if you want something that is a bit specific, you may want to go with the guarding technique. Now we're going to have lots of projects that we're going to work on, and I can't really add them in this introductory video. We are going to have a specific section. We're going to see all of the projects that we're going to work on. And that's it basically, I hope you enjoyed this course and see you in the next videos. 2. Requirements : Hello and welcome. So in this video, we're going to go through the requirements of the course. The first thing we're gonna do is to download Python. We're going to head into python.org slash downloads and then press on download Python 3, 10. So this version might not be the case for you. So it doesn't matter, just click and download whatever version exists on your website. I think that what we're going to do is to check if Python is a new workspace. What we're going to do is to head into CMD. So let me just go into cmd and just write Python. And as you can see, we're going to see Python and the version. So my version is 3.8.10. I'm going to be upgrading it to 3.10 right now. And the second requirement is to download the IDE that we're going to use, which is Visual Studio Code. So we're going to head into Visual pseudo-code. And as you can see, you can download it for Windows right here. It will be either Windows, Linux, or Mac. It depends on the desktop or the workspace working on. And after that, when everything is downloaded, you just can go into the Visual Studio, which is this one. And as you can see, we have a welcome page. We have some updates and then just click on the extensions right here. As you can see after writing Python, we're going to get this suggests install it and we're all set to start our course. So that being said, this is the end of the requirements video. See you in the next one. 3. PyQt5 Version : Hello again. So in this video we're going to talk a bit more about Piketty five before getting into coding and other stuff. So first of all, Piketty five is a set of Python bindings for the QT five application framework. So we do have the QT library that is one of the most powerful GUI library is that we have right now. And actually this is the official home site for the pupae Curie five, which is riverbank computing.com. As we can see, they developed by 35 Piketty for and Piketty physics. And as you can see, you can go ahead and check all of the software and other stuff that they have right here. And Piketty five is implemented as a set of Python modules. It has over a hundreds of classes and thousands of functions and methods. So it can be run on Windows, Linux, and Mac, and it actually is easy to install. So first of all, let's go ahead and install it. So what we're going to do is to go ahead to our command prompt. And I'm going to head over to my desktop. Already created a folder for that, which is 555 apps. And after that, what you're going to do is to simply write pip3 install by Q-Tip five. Now, in my case, I already install it, so I'm going to get requirements. Are I decided, satisfied and indicating that Piketty five is available in my desktop. And in your case, it's going to be downloaded just as we're speaking right now. And after that, what you're going to do is to go into Visual Studio to start the actual coding. So what we're going to do at first is to check the version that we have for Piketty five. So how do we do that? We just had over into the Visual Studio. And what we're going to do is to simply just import a few things that will help us just get the version of the pie Cat5 that we're using. So I'm going to just get from Piketty five dot QT core. We're going to discuss how these later, but for now we'll just need to know diversion. So cutie version, SDR. And then we're gonna get also from Piketty five dot QT. We're going to import the pie QT version. And of course also STR. And answer that, let me just correct this one. And as you can see, if we go ahead and print the QT version and then followed by the by QT version also. And let me go back to here and just write Python, our name of the file. And as we can see, we got diversions that we have for QT and Piketty, which are 5.15.25.15.4. This may not be the case for you. It doesn't matter. We just need to know that it is installed and everything is working properly. So that's it. Basically this is our output. And in the next videos we're going to start with implementing some of the functions and classes that we have and discussing their features. So with that being said, this is the end of this video. See you in the next one. 4. 3Date & Time : Hello and welcome back. In this video, we're gonna go through some of the important classes that you can use. And by 55. And they are the queue date, queue time, AND Q daytime classes. And these classes are actually responsible for the date and time and merging between them using the functions, features, so on and so forth. So instead of starting with the actual applications or the actual building of the Piketty five applications that we can build. I thought why don't we just start with something simple and that we can use n pi 35, that is the date and time. So first of all, let's start with importing these classes. So we're going to import them from the Piketty five dot QT core. And I already created a class datetime dot py. So a script. And from this one we're going to import from Piketty five dot QT core. We're going to import three things. That is dQ, date, Q, sorry, Q. And then we also have the ICU date, time. All right. So now we have everything that we need. We can simply go ahead and print them out. So what we need to do is to print the current date of today. So how do we do that? I'm going to simply print it out right here. So I'm going to print queue date dot current date. As we can see. Now if I go ahead and open up the command prompt, what we're going to do is to head over to the desktop where I have the pike ED50 apps folder. And then I'm simply going to run datetime dot py. Now as we can see, we got what we need, which is the current date, which is 2000 21, the month is 11 and the time is I'm sorry, the day is the first of November. So this is it basically, this is how we can use or get the current date. Now we also have two things that we can use. Two methods, that is the ISO date or the default local long date. So I'm going to use both of them right now. So what I'm going to do is to simply print the queue date dot current date. And then followed by the toString. I'm going to make it a string. And I'm going to use now something to format this current date. And it is actually from the QT class. So to do that, I'm simply going to also get or import the QT class right here. And that is the QT dot ISO date. So as you can see now, if I go ahead and, I'm sorry, let me just write it. Date. Now, if we go ahead and run this again, we're going to get 2021 11 indicating our date. So in this format, and we also have the second format, which is the local long date. And to do that, we're going to simply also use Q date, the current date, and we're going to make it a string. However, we're going to use q t dot default, local, long date. Now if we go ahead and run it again, we're going to get something like this, which is Monday, November 1 of 2021. So these are just ways to format our output into a nice-looking date. So that's it. Basically, this is the first thing we're gonna do. That is to print out the date. Now let's move on to something more about time. So let me just comment this out and now we're going to do is to print the current time. So how do we do that? I'm going to simply assigned to a variable, the queue date, time dot. I'm going to use the function current datetime. Now if I go ahead and print this time, how what we're going to get is something like this, which is the date and time. So as we can see, 2021111. And this is the actual hour of the day, and then minutes, seconds and so on and so forth. So now if we want to make it look a bit more unique or a bit more readable. What we're going to do is to simply use the current time. So we also have. Something that is from the module of the class of time. And to simply print out the time if we don't need the date. Now to do that, we're going to simply run this again. Let's comment this out. And we're going to run it. As we can see, we only got the time this time. So that's it. Basically this is our time. Now we also do have some functions to maybe make this more readable. So how do we do that? We're going to simply use the same functions or the same methods that we use from the QT class right here. So I'm gonna go ahead and print time dot toString. And I'm going to use q t dot ISO date. Now if we go ahead and run this again, we're going to get the exact time which has, this is the hour, minute and second. And if I run it again, gonna see that the second is changing by every time we run this code. So that's it basically. Now we can do the same exact thing for the datetime variable that we created earlier right here. And we're gonna get the same format as before. Now, let's move on to another thing that is the number of days. So we can get the number of days in particular month. And we just need to use the days and month method. And we can also get the number of days in a particular year using the days in year method. So to do that, let me just comment this out. And as you can see, we can simply write the time right here. So what we're going to do is to print out how many days we have in this month. So we need to create the month or the date. So we're going to get the month at 2 thousand to maybe 66. And how to get the days and months. So we'd simply use these and month method. Now if we go ahead and run this, we're going to get 30, indicating that during this month we had 30 days. Now if we want to use the days in year, we can simply also use the same exact format. So we're going to get this and we're going to use the days in year method. Now if we go ahead and run this again, we're going to get 365 indicating that we have the a 165 days in the year of 2002. If we change it, maybe we will get something else. We change it to one more time. And as we can see, we've got now 366 days and we also have 380 days in the month of June. So this set basically for the date, time, and date and time classes. We have lots of methods and functions that can use and get dates, times, and work with all of these sorts of things. With that being said, this is the end of this video. See you in the next one. 5. Buttons: All right, so moving on to a new topic. Now that we have created the first application, we can move on to something a bit more complex, which is creating buttons using Piketty 5. So what we're going to do is to import the same cutie, cutie goo, and qty, which is that we impose it before. And now let's start with our application. So as before, we're going to create the Q application. And we're going to take, this has an argument. And then we're going to create our window, which will be this time Q dialogue. And we're going to explore it in a minute. However, what we're going to do now is to create buttons. So before that, let me just show our window and then of course, label or execute our app. So to do that, we're going to exit and before that we're going to execute our application. So now if I go ahead and run this, we're going to get something like this. So what we're going to add now is some buttons. And to do that, we're just going to need to create a queue push button. And it is very simple actually. So what we're going to do is to create the button one. And it's going to be a queue push button. And it will be in the window w. And of course, if we want to set tax in this button, what we're going to do is to simply use the setText function. And we can say, for example, name. Now if I go ahead and run this again, let me close this 1 first. Run it. And as you can see, we got a button and it says name as the label of this button. So now what we're going to do is to create a few buttons indicating name, maybe just name an age for now. So what we're going to do now is to create button to, and it will also be a cube push button. This window. And button 2, we'll have the text of h right here. And now I think we're good. So if I go ahead and close this, run this again, we're gonna get something like H here. However, we're not seeing the tax because this is too small. So one way to deal with that, we just maybe set the geometry for the whole window. So w dot setText set geometry into 500 by 500. So we have all of the 500s. Now, if I close this and run it again, we're going to get something like this. However, we can't see the name. And this is because the age button is on top of the name button. And one way to deal with that is to simply move the age maybe to the bottom. And to do that we can simply use button to move, maybe move it a 100 by a 100. And now if I go ahead and run this again, so let me just close this one run. And as you can see, we've got name and age. So maybe we just need them to be on the same axis. So now we're good. If we want to make them maybe just in the middle of the page or something like that. We can simply move it a 100, but we also need to move button one by a 100 and 0. So now we go to, if I go ahead and run it one more time, we're going to get something like this, indicating the name and age. Now our buttons don't actually do anything because we didn't create a function for them. Now, when we have a Piketty five application, all of these buttons run on specific events. So this application just grounds when the user presses on something. Now if I press on name, it should do something. And if I press on H, ofs should also do something else. So maybe if I press a name, we're going to print here my name. And if I press on age, it should also print the H. And in this case, one way to do that is to simply use The clicked function that we have using Piketty five and its classes. And to do that, we need to mention that if this button one dot clicked. So if this button is clicked, we're going to connect it with a function that we're going to create and dysfunction, maybe we simply name it Button 1, collect. Now, as you can see, this is not defined yet. Report undefined variables. So this means that we need to create this function. We can create it may be here. So we simply need to create a function. Let's call it Button 1, clicked. And this function is simply going to print my name. So that's it basically now, if I go ahead and run this again, what we're going to do, sorry here we need to just update this. And it's not showing because we need to place it before this one. And of course now if I go ahead and this again, what we're going to get is something like this like before. However, now if I press on this button name, we're going to see my name here. So each time I press on this button, it will create an event that will generate or run this function that we just created here. So how did we do it? We simply use the select function inside the queue push button. And it will just three directors to this function that we created, and it will print our name. Now we're going to do the exact same thing for Button 2. So button to collect. And we're going to print the H, which is basically, let me just write one here. And now, if I go ahead to bus into and use the collect that connect, we're gonna get something like this. So button to click. Go ahead and run this again. We're going to get this. If I press an H, We're going to get 21. If I press a name, we're going to get my name. So that's it. Basically this is how we can create buttons and work with buttons and bike D5. So that being said, this is the end of this video. See you in the next one. 6. Layout : Hello and welcome back. So in this video we're going to talk a little bit about the positioning and the geometry of the Piketty five applications. So whenever we create a function or an application using Piketty five, we need to make sure that our positioning is correct, especially that this application might run on different browsers, monitors, and desktops. So in this case, let me just clarify. Using an application that we can create and that is using the Q application. We're going to create it again. And then we're going to open up a window from Q widget. And then what we're going to do is to create a simple push button. So I'm going to name it B, which will be a queue push button, and it will be in the window w. And of course we're going to set the text into first. And let's move it a bit by 50 by 50. And I think we're good. What we're going to do now is to simply show this window and of course execute the application. So with that being said, if I go ahead and run this, I'm going to get something like this. So we have our push button that is first and this is our window. Now, notice that this window popped up around the middle of the page. And if we want to set the geometry, for example, or for a window, we're going to use the SAT geometry function. And this function will take four parameters. We've used it earlier, but now let's discuss it. So the first two parameters are actually the position n, the monitor or where our application is going to pop up. So if I say 10 by 10, it will pop up using the x and y axis here. So this is the x-axis and the y-axis. So it will pop up around this corner here. And of course, we need to continue with the other two parameters. And they are the height and width of our application of our window. In this case, if I indicate that I need to a 100 by a 100. Now if I close this, Let's run it again. We're going to get something like this. So as we can see, it popped up and the corner, and it has 200 by 200 as height and width. Now in this case, if I maybe move it a little bit, 50 by 50, we're going to get something like this. As we can see, we move that a little bit to the right and to the bottom of the screen. So that's it. Basically this is the set geometry function and how we can use it. Now, whenever we set this position to be absolute. So we're setting the heights with and the position of our window. It's not a very good approach because it's not suitable for the window whenever we need to resize it. So in other words, if we resize a window, the position of the widgets does not change. And this is a problem. Now, a second thing to take into consideration is that we have different display devices that we can use or we may use this application on. So in this case, maybe the dimension of the screen, maybe different of the dimensions of other screens. And this may affect our application and it's overall parents. And finally, whenever we want to modify or improve our application, it's quite hard to choose different sizes, maybe different positions in this case. So all of these taken into account are considered very big problem whenever we use absolute positioning, like we did here with setting the geometry. So to improve this, we have different layout classes for managing the position of our widgets inside the screen, inside our containers. And they have maybe more advantages than this side geometry class. And in this case, it will ensure that this appearance that we have will take place on all display devices no matter what the resolutions are. And of course, whenever we resize our widget, the application or the window will automatically be resized. So we're going to tackle a list of classes that can help us doing so. And the first one is going to be the cube box layout class. And this will help us by arranging the widgets vertically and horizontally using QV box layout and Q H box layout. And we're going to tackle it now. So let me just go ahead and create a new script here. So I'm going to name it Q, box, layout dot py. So let's start with the imputations. So I'm gonna go back to Layout, copy these, and paste them right here. So now what we're going to do is to start with the application. In fact, let me just also copy this one from here to save time. And now what we're going to do is to create two buttons. So I'm going to name it Button 1, and it will be q push button as usual. Maybe thirst and button 2. 2 will also be q push button and it's going to be second. Now what we're going to do is to use the QV box layout. And what I'm going to create as a variable v for the VBox. And I'm going to assign it to Q VBox layout. And what we're going to do is to add the buttons into this box. So how do we do that? We simply call V and we're going to use the Add widget function. We're going to add the button one. And then what we're going to do also is to add the second widget, which is button 2. Now, if we notice that in the layout dot py, whenever we set this set geometry into absolute positions. If we go ahead and let's maybe change this. As you can see, the button will still be at the same position. Whatever we do, it's going to be at the same position. And this does not look good. And it's basically a horrible looking applications since we can't change the position of the button no matter what we do. So what we're going to do now is to create this box and add stretching to it. So how do we do that? We need to use the add stretch. And if I go ahead now and run this, what we're going to get is something similar to the one before. However, we added an empty stretchable box between these two buttons. So if I go ahead now and set the layout of the window that we have to this box that we created. So we're going to use the SAT layout function. And it's going to be this V. Of course after that, what we're going to do is to show this window as before and exit by executing the application. So that's it basically now if I go ahead and run two box layout dot py, we're going to get something like this. However, this time, if I increase the size of this application, the buttons are also going to be increased. And as we can see, we have the difference between them because we added an empty stretchable box right here. So we can't see it, but we have an empty stretchable box between these two classes. So whenever we increase the size, it's going to always be the first button at the first position of the page. And then we're going to have the second button and the top or the bottom of the page. So that's it. Basically this is how we can use the QV box layout and manipulate these buttons and dynamically change the position and size. So that's it basically for the QV box, that is to create a vertical stretch box between these two, maybe two buttons. Now, what we're going to see is the QH box, that is to add a vertical or I'm sorry, a horizontal box between these two buttons. So how do we do that? We simply create a set of the VBox. We're going to create an H box. So how do we do that? Let me just created here, instead of the QV box, I'm going to have QH box. If I go ahead and run this again, We're gonna get something like this. And this time, if I increase the height, I'm sorry, the width of the application, we're going to see something similar to before. So that's it. Basically this is how we can use the QV and QH box layout to improve our experience with Piketty five. Now another class is the grid layout. And this class is going to allow us to create a grid and add it to our window. So how to do that? I just created the QC grid layout that pie, I posted all of the previous importation. And now we can start with our function. So what we're going to do is to copy the previous here. And then what we're going to do now is to create a grid using the QC grid layout. So I'm going to have to create a grid from Q grid layout. Then what we're gonna do is to fill this grid using widgets. So the widgets are going to be q push buttons. So we can either maybe specify a button want to be maybe just q, push button of name. Maybe just Button 1, then button to queue. Push button, button to I'm going to have three or four q push button. So cute push button of beta3 and Button 4, which is going to be also q push button button for. So that's it basically now let me just update this. And now we got we create all of the buttons that we need. Now what we're gonna do is to add them to our grid. So how do you do that? We simply add to the grid a widget, which is basically Button 1. However, we need to specify the position. So the first position is going to be 11. And then we're going to add also widget. And it's going to be button 2 of position. Maybe you want to read that add widget, button three, maybe 21. And then read that add widget Button 4 to 2. So that's it basically now created our grid. We need to add it to our window. So how do you do that? We need to set the layout of a window as before to be this grid. We previously used set layout to be this VBox. Now we're going to set it to be this grid that we just created. After that, we're going to set the geometry. And of course, you can choose whatever we want. I prefer to go by 500s. Now if I go ahead and show this and up and up the application, so app.py execute. And we're going to see something like this. So that's it. Basically we have four buttons. Button one wasn't too bad and three-pointer four. However, this time they are dynamic so they change whenever we create or move and resize our application. So how do we do that? We simply created a grid using dequeued grid layout. We created our push buttons and then add them to this grid. And after that, we set the layout of our window to be this actual credit that we just created, which shows the geometry that we're gonna go with at first. But we can always manipulate or change and resize the application however we want. So that's it basically for this class, we still have one class that we're going to tackle in the next video. See you then. 7. Form Layout: All right, So hello and welcome back. In this video, we're going to continue our layer out classes. And we also have the final class, which is the form layout class. And in this class we're going to discuss how to add rows into the widgets that we have. So let's start with creating our queue form layout class. In this case, what I'm going to do is just simply the new script, name it q form, layout dot py. So now that we have everything that we need, what I'm going to start with is to create a label. And to do that, I'm going to name it label one. And in this case, I'm going to use the queue label. And maybe we just need the first name of the person. And then what we're going to do is to create our pure form layout. So I'm going to name it for layout. And it's going to be q for layout. And what we're going to do is to add this label into the form layout. So how do we do that? We simply right form layout, dot add row. And this row we're going to add this label one. Now if I go ahead and run this, I'm sorry, we ran the old problem. I'm going to run q for layout dot py. And we're going to get k. So we forgot to show the window that we just created. So to do that, we need to show it here. And of course we need to exit by executing the app, so dot execute as before. And of course, we need to add or set the layout of the window to be this form layout that we just created. So you can say that W dots layout to be deformed layout created earlier, so forth, lay out. And now we're good. So if I go ahead now and run this again, we're going to see something like this indicating that we have FirstName as a label. Now what we're going to do is to add maybe an input where the user can add his firstName. And in this case, what we're gonna do is to simply added after the label and to add another line, we just need to let a variable of input 1 to b of q line edit. And now whenever we add row two, this form layout. So here we have labeled one and we're going to add input one as such. So if I go ahead and run this again, we're going to get something like this firstName and where the user can also edit or add his first name. Now we're going to do the exact same thing for the last name. So maybe labeled two will be equal to q label and last name. In this case, we're going to need an input two of q line at it too. And of course, after creating the form layout and inserting the first labels and inputs, we're going to also add a new row, in this case for labeled two and input 2. So that's it basically now if I go ahead and run this again, we're going to get something like this FirstName, LastName, and so on. So now what we're going to do is to add maybe more information about this person. However, maybe one line won't fit. So what we're going to do is to merge something from a previous class, which is dQ box. And in this case we're going to use the vertical stretching for the box. In this case, let me go ahead and add a label three, indicating that extra information may be. So extra information. And in this case, we need an input from the user that consists of two lines, for example. So input 3, one is going to be DQ line Edit. And then input 3, 2 is going to be a different queue line added to. So Q line edit. However, we need to merge these two to one box. So how do you do that? We're going to create a box. And it will be of, of course, the QV box layout since we need to have them vertically. So Q, the box layout. And what we're going to do is to add these two inputs into this box. And after that, we need to add all of these books into the form layout that you just created. So how do you do that? We simply use the Add widget function that we have to input 31. And then we also need to add the input 32. Now in this case, we have our box consisting of two inputs from the user that are vertically on the screen. So what we're going to do now is to add an Euro inside this form layout that consists of the label three and this whole box here. So that's it basically now, if I go ahead and run this again, going to get something like that, indicating that we have FirstName, LastName, and we have extra information of toolboxes. And as you can see, if I change the width, they will be resized. So that's it basically now what we can do maybe is to make the user choose between two categories. And in this case, we can use the box as horizontal to place the categories in. Here, for example, we have category one and category two. So we can use the radio button if we want to. They user to choose only one category. So in this case, what I'm going to do is to create a new label indicating maybe the category type. So to do that, what I'm going to do is to simply create a new label for, which will be Q label of category type. And after that, I'm going to create a new box, however, we needed horizontally this time. So I'm going to have H box indicating that horizontal box. And it's going to be Q H box layout. And we need to add widgets. And in this case, what we're going to add is Q radio button. And this is a new one that we're going to explore now. So we're going to add q radio button, and it will be Category 1. And then we're going to add a new widget. I'm sorry, here we have H box in both cases. And we're going to add q radio button of category 2 in this case. And now after creating this H box, what we need to do is to add the stretch. And in this case, we simply can do it using H box that add stretch. And of course after that, what we're going to do is to simply add all of these labels and box into the form layout that we just created. So form layout that add row. We're going to have the label for. And then we're going to have the input or the H box that we just created. So if I go ahead and run this again, we're going to get something like this, indicating the category type, category one and category two. Now recall that we just use this one add stretch in order to, if we increase size to have this category one and category two. And the user can only choose one type since we chose to have a radio button. And this will make sure that the user will choose one and only one category. So that's it basically now we can just add maybe buttons for the user to submit the form. So let me just do it right here. So what we're going to add is a new button. So I'm going to create a new row here. So form layout that add row. I'm going to add a cube push button. In this case it will say, submit the form. Now if I go ahead and run this again, we're going to get something like this. Submit the form. And of course, we can also add another queue push button maybe to cancel this form. So we can say Cancel here. Now, if I go ahead and run this one, fires time, We're gonna get something like this, submit the form and cancel it. We have FirstName, LastName, extra information, and the category type right here. So that's it basically for the queue for a layout. With that being said, this is the end of the layout classes that we have. We explored the cube box, cube grid and q form of this will help us building out pi QT five applications later on when things get complicated. So that's it basically for this video, with that being said, this is the end of it. And see you in the next one. 8. Label: Hello and welcome back. In this video, we're going to talk about witches. You have already seen some of them such as the label, the line, edit, the push button, and radio button. Now in this video we're going to discuss some of these and then we're going to discover new ones. So what we're going to start with is the Q labor that we have used earlier right here. So first I'm going to create a queue label that Py Script. And inside this, we're going to work with the Q labor class. So the first thing I'm going to do is to just import everything that we have right here, this new script. And what I'm gonna do also is to start the application with the window that we need to create. And of course I'm going to show the window with the application execution at the end. So this is for the setup. Now what we're going to do is to create our labors. So we have two methods to create the label. So we either name it label one and just create the queue labor right here. And then after that, we can set the text of this label into, for example, they will label one. Now the second method is to actually why creating dq label, we just set the text inside it as a parameter or an argument like this. So that's it basically, no, he will have a narrow and now we're good. So these are the two main methods that you can do in order to create this. Now what we can say is, let me just run the script and show you. So if I run Python q labeled dot py, we're going to get something like this. However, we didn't add these into the actual Python script or the window, so we just need to do it here. So as you can see, we have the label one that we created q label. We need to add the parameter or argument W, indicating that this label is at this window w. Now if I go ahead and run this script, I'm going to get is labeled one inside our window right here. Now if we want to add label to what we can actually do is while creating the queue label and adding the name, we can add a new argument indicating the window that we need. Now if I go ahead and run it again, we're going to get labeled one. And as you can see, we got two on top of the labeled one. So in order to make it look better, we can label to the move maybe 50 by 50. And of course we need to set the geometry of this window into something like this. And as you can see now if I go ahead and run this again, we're going to get label one and label two as expected. Now, if you want to just move the labels and we want to choose their positions, we can actually do so by using the VBox that we learned about earlier. So how do we do that? First of all, before creating this label and placing it into the window, we're just going to create a labor without placing it in any place. So we have these two labels. Now what we're going to do is to simply set the alignments of this labor. So label one will be of alignment. And I'm going to use the q t dot. And we have a function called alignment center. So aligned center. And I'm going to need label to be set at the right, so q t dot aligned. Right? Now what we're going to do is to create our box in order to contain these labels. So what we can say is that box is going to be equal to q VBox layout. And then this box is going to have the label one and also labeled 2. Now, if we want, we can add the stretch between them. So as before, we can add stretch. And now we're good. What we can do also is to simply just show or set the layout of the window to be this box. So how do you do that? You can simply write w dot set layout and we're going to add box into it. So now if I go ahead and run this again, we're gonna get something like this. So we have the label one in the middle and labeled to the top or the bottom right corner right here. And this is due to the stretching between these two neighbors and of course to the alignment or the SAT alignment to the right for labor 2. Now if I remove this for example, and run this again, we're gonna get something like this. So as you can see, labeled two is not in the top or the bottom right corner and label one is not the top center of the screen. So that's it. Basically this is what the stretch does and of course, the set alignments are also needed in order to get the desired output. So this is basically for the labor class. With that being said, this is the end of this video. In the next video we're going to discuss the Q line edit. So see you then. 9. Line Edit: Welcome back. In this video we're going to discuss the Q line edit class. So first of all, before starting, let me just go back to a previous script and copy all of these. Going to paste them here and the end lines right here. Now we're good to go. What we're going to do is to start with creating a line edit. So I'm going to name it input. One is going to be q line added. And what we're going to do is to use some functions that are available for us inside the line at it class. So before doing so, let me just run this script. And as we can see, we have nothing in it because we didn't add this line added into the layout of the window. Now one way to do that is to just add some rows into Form layout. And inside these rows we're going to add these edits. So to do that, I'm just simply going to create default layouts right here. I'm going to name it form layout Q for layout that we've used earlier. And then we're going to add a row to it. And inside this row I'm going to have the input one. And of course before showing two window, we need to set the layout to be this formula that we just created. Now if you go back and run this again, we're going to get something like this indicating that the user can use this input or can enter the input that he wants. Now what we're going to do is to modify or improve this line edit. Now one way to do that is to specify the maximum length, for example, or set the alignment of this input. So we're going to work with multiple functions. The first thing we're going to do is to check if this input is an integer or not. So what we can do is actually to try and put one, that end validator. So we're going to use the set validator. And inside this we're going to use DQ and validator. So what this function actually does is that it will allow the user to enter just integer. So as an example, if I go ahead and run this again, we're gonna get this. Now, I'm trying to write and decay, but some letters, there's nothing showing up in this input. However, if I write some numbers, are going to get this. Now, as you can see, we have so many numbers if we want to just limited to two numbers, for example, we can set the maximum length of this and 22. So how do you do that? We're going to use the input, the set max length into two. Now if I go ahead and run, again, going to get something like this. Now I wrote some numbers, however, I'm trying now to write some more, but it will not take it. So this is it basically for checking for the integer. We can also set the alignment for either center, left, or right. We did it earlier. Now what we're going to focus on is some float numbers. So I'm going to create another input, which is input two, Q line edit. And inside this, we're going to create a set validator of double. And how do we do that? We're gonna do the exact same thing as we did before. Set validator, now a set of Q and facilitator, I'm going to use the q double validator. In this case, it will check if this is a double between two numbers. I'm going to maybe just put 0 and 100 by a 100. Now, I want to have five digits after the decimal point. So this is the maximum digits aloud. Now if I go ahead and add it to the form layout, that add row, we're going to add input two. And of course a file. Go ahead and run this code again. I'm going to get something like this. However, this time here, I can maybe at 33 point, if I press 66666. Now if I continue on pressing on sex, nothing will happen because I specified that I need just five numbers after the decimal points. So here they are five numbers. Now and now, whenever I try to press some more numbers, nothing will happen because this is the maximum I'm allowed to use. So this is it for the q double value data. Now let's move on to some other functions. We also have some line added or an input for passwords. In this case, what we can say is that we need a new Q line edit. And inside this, we're going to create a set Eco mode. And we're going to use the Q line, added that password. And after that, we can add it to the default layout. It will be the third one. And we're going to row, and this is empathy. Now if I go ahead and run this, we're going to get something like this. However, whenever I type inside this input or q line edit, it will not show because this is password, which isn't supposed to be shown. Now, another function would be the read-only text. And in this case, let me just create an input for and it will be Q line at a two. So I'm going to create queue line edit. And of course we're going to set read only. It will be equal to true. Now if I go ahead and add it here, form layout, but add row. We're going to add the input for. Now what we're going to do is to simply run this again. And we're not seeing anything here, however, we can try to do it. So if I set the label or the SAT detects inside this slide edit, what we can do is to set tasks into this as read only. Close this run. As we can see, we got this as read only and we can't actually right into it because we set the read-only function into true. And this won't allow the user to add or change this text right here. Now we do also have some other functions. So for example, if we want to see the text and at the input, we can print it out using input for the text. So if I go ahead and run this, we're going to get something like this is read only, indicating that this is detects an input for. Now, another thing to take consideration is the font that we're using. So you can change the font and the pixel size. And one way to do that is to simply use the set function. And you need to specify the font and the font size. For example, here we're going to use 12 and Arial. If I go ahead, run this again, we're going to get, so here we have an error. Let me just check it. All right, so here inside this font, we need to create or use a queue font here. And now we're good thing, let me run again. And yeah, so this is the font and the size changes from before. So that's it. Basically we have so many methods and functions inside this edit line, but these are the most important ones that we may use in our pie could've five applications later on. So that being said, this is the end of the queue line added video. See you in the next one. 10. Radio Button: All right, so in this video we're going to discuss another class that is the Q radio button class. To do so let me just create a script. I'm going to name it Q radio button by. And what we're going to do is to create or import the same thing that we did earlier. Then what we're gonna do is to create an application. And I'm going to use a widget for this one. So I'm going to name it W. And maybe I'll simply copy this from here with all of these. So let me just go ahead it here. And we set q, which it, and we get. So now if I go ahead and run this right here, and we're gonna get Python, you rate your button dot py. We're going to get something like this, which is an empty window. Now what we're gonna do is to create our buttons. And in this case, there will be of type q radio button. So Button 1 will be Q radio button. And I'm going to name it first. Then what Into will also be Q radio button. And this will be the second. Now what we're gonna do is to create a sort of box to add them together. And usually radio buttons come in a horizontal manner. So what we're going to do is to create a box that is horizontal using the QH box layout. And as we can see after getting these buttons, what we're gonna do is to simply add them to the box by the box As function. And we're going to add Button 1. Then we're going to also add button too. And of course, after finishing from this, what we're gonna do is to simply run this again. But before doing so, what we actually need to do after creating these buttons is to simply set delay out of our widget or our window into this box. So how do you do that? We're going to use set layout function from the keywords, the class, and we're going to set it to be this box. Now if I go ahead and close this, run it again, we're going to get something similar to this. We have two buttons. First, second, and because they are radio button, we can only choose one. So we're going to toggle between them. Now what we're gonna do is to set one of them. And we're going to set the first button in this case, to do that, we can simply use the S checked. So it is a function, indeed radio button. And I'm going to set it to true. And now if I go ahead and run it, again, we're going to get something. Alright, so we do have an error. So I'm using such act instead of Es geht. Now run, we're going to get first second, and this time we got first set from the beginning. Now what we're gonna do is to simply create a function to know which button is actually chat right now. So to do that, let us start with creating and D function, going to name it, maybe just the radial function. For simplicity, I'm going to put it here. So we have radio function. And this function is responsible to know or to let us know which button is checked. So it's going to take button as a parameter. And it will take, or it will check if the text is equal to the first button, which is first. So if it is equal to first, we're going to print that this first is the button selected. And if this is not the case, then it surely as the second one. In this case we're going to print second is the buttons selected. Now to merge this function or to use this function with our buttons, what we actually need to do is to use the toggled, my method and our do radio button class. So to do that, but we need to do here is to add Button 1 dot, toggled dot connect to the radial function that we just created. We're going to use lambda. And it will take create your function and it will have bottom one is parameter. We're gonna do the exact same thing for button 2. We're going to use lambda here, right? You function. And it will take button to, in this case. Now what we said here is that we need to check if the button is toggled. We're going to run this function using Button 1 to print first is the button selected. And if button 2 is the one toggled, we're going to print. Second is the button selected because we've given it button to as a parameter. And we still have one more thing to consider and to pay attention to in our code is that whenever you toggle between these two buttons, we either go from one to two or two to one. So these two functions are going to run. And in this case what we're going to do is to check at first if detects is equal to first. This means that this is our first function or our first button. And in this case, what we're going to need to do is to check if the button is checked. So if this is the case, we're going to print that this button is selected, and if not, we're going to print that it is not selected. So how do you do that? We can simply check if this button is checked, we're going to use the object right here. So if b is checked, we're going to say if this is true, we're going to print this one. And if this is not the case, we're going to print that. First, is de-selected. The selected. And we're gonna do the exact same thing right here. So if b is checked, we're going to print that this is the button selected. And if this is not the case, we're going to print that second is the selected. So what we actually did here is that whenever we press on one radio button, these two functions are going to get cold because we're tackling from button one to two hours from two to one. And of course, if these two functions are going to get cold, we're going to start with Button 1, which is right here. So let's suppose I am at button one and I pressed on the second right here. What we actually did is to call these two functions right here. And these two functions are going to get called using the specific parameters. So here we have our button, one right here, so let me have it here, Okay? All right, so we're gonna get Button 1 here. And it's going to check if the text is equal to first. Yes, it is. It's going to go into this condition. Now we're going to check if B is checked. Note this is not the case because Button 1 is not checked. We toggled from button, want to do the button 2 which is now checked. So Button 1 is not set. We're going to print first is de-selected. Then we're gonna move into the second function, that is this one. Button two, we're gonna get button to as a parameter. So we're going to enter this condition and we're going to check if button 2 is checked. If this is the case, which is right, we're going to bring that second is the button selected. So let us test set. If I go ahead now and run this code, we're going to get this. And thus we can see we are at first now. If I press on second, I'm going to see that first is de-selected, second is the button selected. Now if I press on first again, I'm going to get second SD selected. First is the button selected. And this is because these two functions are going to get run. So that's it basically for the queue push. Sorry, this is the cure rate you button. And we do have lots of methods inside this class, but we're going to stick to these ones. So that being said, this is the end of this video. We're going to see you the next one. 11. Check Box: Hello and welcome back. In this video we are going to discuss a new class that is dQ checkbox class. And this class is going to be very similar to the queue radio button. In fact, let me just copy of this. And of course we're going to start with a q widget right here. So I'm going to have the app. Then we're going to have to exit. And of course, we're going to need to show this. So that's it. Basically, this is how we can start. Now what we're gonna do is to create our buttons. In this case, the going to be of type checkbox. So Button 1 is going to be q checkbox and it's going to be named first button to Q checkbooks. And this is going to be second. Now what we're gonna do is to just add them to a QH box as before. So I'm going to emit box Q H box layout. And it will have these two buttons, soapbox that add widgets, button one. And then we're going to add button too. After that, what we're gonna do is to set the layout of our widget into this box. So as you can see now, if I go ahead and run this Python QC check box that pi. And we're going to get something like this. And I can check these and uncheck them as much as I want. Now what we're gonna do is to create a function that let us know as before, if this button is the one tag or if it is selected or deselected. And to do that, I'm gonna do the exact same thing as before. So I'm going to name it selected or not. And this function is going to take a button and it will check the state or the text of this button. So button dot txt. If this is equal to first, this means that this is the first button. And we're going to check if the button is checked as before. And now if this is the case, so if this equal to true, then we're going to simply print that first is selected. And if this is not the case, we're going to print that first. Is the selected. After that. What we're gonna do, if this is not the case, we're going to also check if the second button is checked. So if button that x is not equal to first, this means that we are at the second button. And in this case, we're going to check if this button is checked. So if this is decays, print that second is selected. And of course, if this is not the case, Jen, just simply print that second. All right, So I think we're good. Now we just need to add this function into our buttons. And as before, we're going to use one method that is the toggled. However, we're going to use also another method that is the state changed. So for method or button one, we're going to use Button 1 dot state changed, and we're going to connect it to the Select or not with Button 1 as a parameter. And button 2, we're going to have it as toggled. And we're going to add to it this function that is using the connect method. We're going to add select or not. And it will take button 2. Now if we go ahead and run this code. So let me just go here and run it, right? So we do have one error at line 31. And it says that argument one unexpected NoneType. Alright, so what we are saying right here is that we do have the button, however, within choose lambda. So let me go ahead and use it here. And now, let's run it again. And as you can see, we got our first second. And this case, if I press on thirst, first is selected, if I press on second, second is selected. Now what we can also do is if I press second one more time, it is deselected. So to explain it in a bit more, Broadway, and I'm going to do is let me just move this all the way to here. And what we're gonna do is to look at it from the beginning. So at first, we don't have anything, so let me just start with it. So as we can see, if I press on first, What's going to happen is to button one is going to call this function using Button 1. It's going to get here, and it is actually equal to first. So we're going to enter this and we're going to check if Button 1 is checked. If this is the case, then we're going to bring that first is selected. If this is not the case, we're going to print that first is deselected. Now after that, we're just going to run this one time because we're not toggling between the two buttons, we simply changing or selecting and de-selecting the same buttons. So if I press on this one, I'm going to get versus the selected. Now, if I present a second, I'm going to get second is selected because they are two different buttons with two different maybe goals or objectives. So they not like the queue radio buttons that we faced before, hidden here, we do have them like two different buttons and they are not related to each other. So this is it basically this is for the Q checkbox. This is just a basic idea about how to use them and what we can do with them, how to select and deselect them and know exactly which button or a checkbox is actually selected or not selected in this case. So that's it basically for this video. See you in the next one. 12. Combo Box: All right, So hello and welcome back. In this video we're going to talk about the QC combo box class. So first of all, I just impose that everything that we did earlier. And then we're going to start with building the application as usual. So we have the Q application that takes the parameters. All right, So we're good. Then we're going to build our queue, which at, so Q, which is going to be the variable w. Then what we're gonna do is to simply show them. And of course we're going to exit the system by executing the app. So this is our basic application. Now, let's start with creating the cucumber books. And basically the cucumber box is the box that contains several selections and you can choose one of them. So let me just start with creating the cucumber books and name it combo box. And in this case it wouldn't be cucumber box. And then we're going to add some items to it. So combo box, that add item. I'm going to add first. Then I'm going to add now multiple items using the items at items instead of item. And this will allow us to add an array of items. In this case, I'm going to add a second, then third, fourth. Now we do have our combo box. We need to display it. So let me just before everything. If I go ahead and run this, we're going to get an empty screen because we didn't add this combo box to our window. So one way to do that is to actually create a Q H box layout maybe. And then you can add this combo box to the QH layout bugs. And of course we're going to set the layout of the widget to be the spokes. So to do that, we can simply create the Q H box layout. And what we're gonna do is to simply add this to this box. So we're going to add the combo box to our box, which is named books. So add widget and adding the combo box that you just created. And after that, we need to set the layout of the widget of our actual, which is W, to be the spokes that we just created. So we're going to add w dot set layout, and we're going to add box as the layout. So that's it basically now if I go ahead and close this and try that again, gonna get something like this. The beginning that we have our combo box right here. So our combo box looks like this. For example, we can change our selection. And it will only select one at a time. Now to modify this or to know which selection is exactly, are we, are. We can create a function that tells us exactly this. So let me just create it here. It will be a name, maybe the selection. And we're going to print what index or what selections are we on. And we're going to simply use our combo box that we just created. In this case, it will be the function that is to get the current index that we have and we can access it using combo box or current index. So this is the current index that we add. We can add here is the current index. We at right now. And then we can also print the actual selection using the current text message. So we're going to print that. The new selection is. And then we simply add to it the combo box that current texts. And we get, so now if I go ahead and run this, we're going to get this if I present second. All right, So we didn't add a trait here. We need to just call it the function whenever the current index changed. So we're going to add a box that current index change. If this is the case, we need to connect it to the selection that we just created. So we get now a go ahead and try it out. I'm going to delete this, close it and open it one more time. Now if I press on this, I'm going to get two as the current index we're at right now, the new selection is third and will be the same for all cases as we can see. And this is how we can use this function or use the cucumber box widget that we have an output QT five applications. So that's it basically for the combo box, we do have lots of other methods, but these are the most famous and most used ones. With that being said, this is the end of this cucumber bucks video. See you in the next one. 13. Spin Box: Welcome back to this new video. In this one we're going to talk about the cube spin box that we have and Piketty fire. And it is a bit similar to the cucumber box, so let me just go ahead and create scripts. So Q spin box dot py. And we got, so what we're gonna do is to create as before or import everything from here. And then we're going to start with the application. And it's going to be a widget also. And then we're going to simply showed. So this is our setup. Now what we're gonna do is to start by creating our spin box. And to do that we can simply create at first a QV books to be the layout. So I'm going to name it box, and it will be Q, the box layout. And then what we're gonna do is to simply create the switch at w of this box that we created. So I'm going to set the layout of w to be the sparks. And now we can start with our current to spend box. So what we're gonna do is to start with creating a label that is for the value or the price, for example. So let me just create it labeled one. And it will be q labeled, and it will be the value here. And then what we're going to do is to create or add this to our box at first. So boxed add widget. We're going to add this label one to it. Then we can start by creating our spin box. In this case, I'm going to name it spin bucks and it will be of Q spin bucks. Now to add values discipline, but it's going to be on the screen. So now what we're going to need to do is to simply add this to the box that we have. So we're going to add the widget here, so is added to the box and now we can show it. So let me just go ahead and run this right now to spin box. Now. And we're going to get something like this. So the default value is 0. And you can increase or decrease the value as much as you want. As you can see, this is our value and this is our Q spend bus. And of course, if we want to just maybe place this in the middle, we can simply use here. After creating the label, can simply set alignment to be at the center. So q t dot alignment center. And of course, let's run it again as usual. So many two clusters before. And now. Fahrenheit, we can see that this value is at the middle of the screen and we have our Cushman box that we can data and manipulate it. So that's it basically for dq spin box. We can also know what the value is. So we can create a simple function to do that for us. So let's suppose I need to know the current value. And we can simply print, maybe just print the current value is. And then we can simply add here the spin bucks that value. And this will be called whenever we change the value of the spin box. So we're going to spend box dot text changed and we're going to connect it to the value that we just created. And now, hey, we need to add STR because the value is an integer and we're appending a string. Now if I go ahead and run this, we're going to get something like this. Hitting that. Every time we change the value of the text change, we're going to get current value is and followed by the value that we have right now and spend box. So that's it basically for the spent box class. This is the end of it. So see you in the next video. 14. Slider: Hello and welcome back. In this video we're going to discuss a new class that this dq slider class. So to do that, what I'm going to do is to at first create our queue slider right here. And now what we're going to do is to import everything like we usually do. So let me go ahead and do that. And then image, just copy our application with our kitchen window. And finally, I'm going to close it like this. And We're good so we can start with our hue slider script. So what we're gonna do is at first create our slider. And we have it by two forms, either horizontal or vertical. So to do that, I'm going to do is to simply created right here. So let us start with slider and then an image slider. And it's going to be a class Queue slider as usual. Now, if we want to have it horizontally, we're going to use here q t dot horizontal as argument. So acuity, not horizontal. Sorry. Alright, this, and now what we're gonna do is to create a QV box in order to add this into this box and then set the layout of the actual window, which it to be this box that we come to create. So to do that, I'm going to name it a box. And this box will be of type q, VBox layout. And then after creating the slider, we're going to add it to the box. So box that add widget. And we're going to add this slider right here. And before we finish, we're going to simply add or set the layout of our widget. Set layout to be this actual box that we just created. So now if we go ahead and run this and we just up and Q slide or not pyre, we're going to get something like this. And as we can see, we can change this slider. We can debate through the values that we have. Now this is for the horizontal one. If I wanted vertically, I simply change this one into vertical. Now, run it again. We're going to get something like this, which is a vertical slider. Now, let's go ahead and add some extra information or extra features to this slider. We're going to start by setting the minimum and maximum values that we can have. And to do that, we can simply use the functions that are set minimum and maximum. So Slider the set minimum. And we're going to set it, for example, to 0, slider dot set maximum. And I'm going to have it at 10, at 100, I'm sorry. Now if I go ahead and run this, let me just change this to horizontal. And now, Ryan again, right here, we're going to get something like this as before. And we can't see the values right now because we're not using any method that allows us to do so. So if we want to do it, we can create some functions that we're going to do later in this video. But for now, let's stick to this that we have right here. So we have now our minimum and maximum. One way to do, one way to know how or where we are on this slider, we can use the function that is the set value, which is to programmatically control the slider to set a specific value before starting the application. And to do that, we're going to use set value. I'm going to set it to 50. And it should be in the middle, because if we have 0, so these are the minimum and maximum and the middle should be at 50. So if I go ahead now and run this, we're going to get something like this, which is exactly at 50. So if I change this to a 100 now and run it again, I'm gonna get something like that. And notice that if I change this, for example, to a 101 and run this, it will be at the end also. So no matter what, the initial value, if it is greater or smaller than the minimum and maximum that we have, they're going to be at the edge or at the end of them right here. So for example, if I place here minus 52, I'm gonna get the same result at 0. So that's it. Now, we do also have some methods about the thick that we have. Now we can see it right here, but we can add it. So we need to add at first the position of the things that we want. So we have the method that is set deck position. So I'm going to use slider dot set the position. We do have some functions as we said, and we're going to use them. So for example, we do have the text both sides. And this will allow us to have texts on both sides right here. So if I run it again, I'm going to have text above and below. Now if I want them to just be above, I'm going to use decks above. And let's run as we can see the above. And of course if we want them to be below, it's the same thing. We can do a two. And we also have two other things. This takes left and text right, so takes left. However, since we are using the horizontal and we are using texts left, it will actually show us the texts on the upside of our window, our application, our slider. And as we can see, if we use it for texts right, right here, we're going to get the slider with our text below. So that's it. Basically these are the methods or what we have for the text. Now what we can do is to actually set the tick interval. So let me just go ahead and do it here. I'm going to have slider. But set that interval. I'm going to set it to 10. Now let's run it again. As we can see, each time we move one tick is going to be 10. Now, if we change this to a 100 and run this again, we're going to see only two texts because the value is right now a 100. And of course, if we change this into one, we're going to see lots of texts because we are having a value of one for each tick that we have. So that's it. Basically we're going to hear, have a hunted texts right here. Now, these are some of the functions that we have in the slider. Now, what we have in the signals in that queue silo class, we have some functions such as the value changed. That is, to notice that the value has changed in the slider. We have the slider pressed. That is to notice that the user starts to drag the slider and the slider moved, which is when the user gas the slider and move it right or left, up and down. And then we have this slider released, which is when the user releases the slider and is no longer hold in it. So let's use some of them right now. And we're going to use Connect to connect it to a function that we're going to create before. So let me just do that right here. So what I'm going to do is to simply create a function that is just as the name indicates, value changed. And we're going to simply print that the value is changed into. And we're going to add here the slider value. And now we're good. So if I go ahead and use slider, value, changed that connect and connect it to the value change that we just created. And let's run this. We're going to get something like this. And of course, if I change this, I'm going to get the d value is changed to whatever value we are on right now. So as we can see, this is a very great way to know the value that we are on by simply one line of a function. Now let's move on to another method that is the slider breast. And this will indicate whenever we press on this slider. So I'm going to create it here. Slide the breast. And we're going to print that. The slider is pressed. And we're going to use it right here. So slider, that slider pressed dot connect and connect it to the function that we just created. Let's close this and let me just comment this out to visualize our slider. So let me go ahead and run this again. As we can see, we got our slider. And now whenever I press on now slider, we're going to have the print statement, which is the slider is pressed. And whatever I do to no longer be important because this will only detect whenever we press on the slide. And now if I let go and press on it again, I'm going to get it again. As long as I'm President net, it will never change. The slider will be only pressed. Now if I let go and do it one more time, we can see that it will keep printing. Now. The other method is to check if the slider is moving. So I'm going to create slider moving. And we're going to print that the slider is moving. Now what we're gonna do is to have the function that slider moved and connected to the slider, moving that to just created. Now let's go back run. And as we can see, if I press on it, I'm going to get decider expressed as first. Now if I move it one time I'm going to get slider is moving. And each time I move, I'm going to get the slider is moving. Now, remember, so if I press on it, we can see that we get cited as breast here. Press on it one more time, I'm going to get it one more time. And now each time I move it, I'm going to get the slider is moving because it will detect the movement of our cider. Now the last function that we're going to talk about is the slider released. So let me go ahead and create it here. Slider released. And this will only print our value or our statement that the slider is released. Now we can add actually at the value that we have. So really just add value. And then we're going to add a slider dot value to indicating which value. We released our slider on. Salami. Go ahead and run this here. And of course, I'm going to stop this from moving because 12 be an obstacle in order to show the release part. So we're going to use this slider released, not connect and connect it to the slider released that we just created. Now let's close this. And let me just change this interval into tens. Let's run. And as we can see, this is our slider and our intervals. If I move, we're going to get the solder is pressed. Now whenever I stop going to get the slider is released add value, and we're going to get the value that we are on right now. So that's it basically now whenever I change, we're going to get the value that we have. And this is how we can work with these sliders and their functions and methods and create a simple GUI to get values from the user. So that's it. Basically this is for the Q slider class, but that being said, this is the end of this video. See you in the next one. 15. Menu Bar: Hello and welcome back. In this video, we're going to talk about the CPU Menu bar class. So first of all, we have our empty pocket 35 application. Now the first thing we need to change is this Q widget, because the menu bar actually works on a queue main window. So instead of having q widget, we're going to have Q main window right here. And what we're going to do is to simply create our Q menu bar using this main window. So to do that, I'm going to name it MB, indicating menu bar. And we're going to use w dot menu bar as we can see. Then what we can do now is to add a few things to this menu bar. One method is to add manure. So I'm going to name it first. And we're going to add a menu to this menu bar. And I'm going to name it may be first. So now if I go ahead and run this, sorry, here we have the old script. Now, Q menu dot py. We're going to have something that looks like this. We have our first add menu or menu that we just created using the Add menu class or method. So that's it. Basically, this is the first thing we can do. Now what we can also say, let me just add another menu. This will be second. And let me just close it and run it again. I'm gonna get first second. Now we can add a few things to this menu bar. For example, whenever we press on first, something will pop up here and we can make some commands, for example. So now that we have this first here, what we're going to do is to add to it another menu. And this will be, for example, create file. Then we're going to add another thing, for example, create folder. And let me just have a look at it. Run. We're going to get this. Whenever I press on this, I'm gonna get Create file, create folder for now. And they won't do anything because we don't have any function that supports these actual menus. Now what we're going to do is to create a couple more. So first that Add menu, we're going to maybe save. And then we're going to have another Add menu. And in this case, I'm going to name it Save As. So as we can see, let me close run. We're going to get something like this. And this time what I'm going to do is to press on this. And what we can see here is that we have, for example, save us. And let's suppose that we need to save it as a PNG or JPEG. And in this case, what we actually need to do is to create another bus or another menu here with few more options. So let's suppose we have an image ready to save it. We can let the user decide if we want to save it as PNG, JPEG and so on. And to do that, we need to add actions to our menu. And we can actually do it by using the add action method. So let's suppose we have this Menu Save As, I'm going to name it Save As. And then we're going to add action to this. I'm going to name it save as PNG, and then save us the add action, save as j, pj. Now if I go ahead and run this again, we're gonna get something like this. Let me just you get a bit bigger. Now if I press on this, we're going to see save as PNG and save as JPEG. So we have few more options before deciding the final output that we need. Now one last thing I want to add is, so let me just add it here first that add manure and maybe quit. And this should actually make us quit our method of our function right here. So if we have this spiky 5 application and present quit here, it should maybe just close. So let me just create a function that does this for us. So and this is our function. And we'll simply close our absolute up that nav. If we want to actually quit, we just need to create a queue action. And instead of having first add menu and simply adding this, what we're going to do is to add an action to our file or our first. But whatever we named it here. So what we can do is to maybe create a queue action here and to be wet. And then what we're gonna do is to simply add it. So add action, and we're going to add quit. Now whenever we have a trigger on this first, by this Q action right here. So whenever we press on the CQ action that we just created, we're going to connect it to our function that we just created. So let me just go ahead and run this. All right, so we do have an error saying that argument one has unexpected type q action. And I think this is because we use quit and quit. And these two, we have the function that is good and the variable that is also a cue action, quit. So let me just go ahead and change this to WT. Now, let me just try it again. All right, so we do have now our function. And if I press on first, we're gonna see quit. And now whenever I present quit, the program will just quit and the app is going to be closed because we use the applet quit function that we have right here. So that's it. Basically this is how we can quit or hues some of the functions and methods that we have in the menu bar. We first created the menu using the menu bar right here. Then we added some menu to it or some functions and features. In this case, we are first, second, and inside this first, we do have a couple of commands that you can do or the user can use. And in this case we have some of them such as create file, creates folder, save, save as. And they don't really do anything right now because we didn't add any functions to them. But they just here to show how to create a bulky five application and how to use Menu bar in it. And we finally have the qt function and I actually implemented because I thought it is quite straightforward and a great addition if we want to close the application using just a simple line of code. So that's it basically for the Cuba. Cuba we do have some other functions such as the title or the SAT test set, shortcut, and clear. And they are pretty straight forward. So if for example, let me just use the clear right here. So if you have our menu bar and use the clear method and try it again, we're going to see that it is cleared right now. So that's it. Basically this is for the QC menu bar class. See you in the next video. 16. Tool Bar: Hello and welcome back. In this video, we're going to go through Q toolbar class and purified. So as you can see, we have our previous invitations, our app application creation, and then we have a window from Q main window. And we have the show method to show this window. And after that we have the exit as before. So to start with, we need to create a toolbar using this window. So we're going to use q main window to create toolbar using the Add toolbar method. So I'm going to name it toolbar, and it's going to be w dot add toolbar to this window. And we're going to name it may be phi, let's say. Now what we're gonna do is to actually create some actions inside this tool bar. And to do that, we need a few images. For example, if we want to save up and exit few things like that, we can add them. So let me go ahead and create or get these images and we come back and continue. Okay, So we do have this Save icon, and we also have this exit icon right here. So let me just create these actions. So maybe to open, we're going to name it open, and it's going to be a cue action. Now this q action takes two parameter for now. The first one is dQ icon, which is so sort of image. And in this case, I'm going to use the upended PNG image. And if we don't have an image, we're going to display just open. And then we have the exit. And it will be of the same type. So exit, Q action and Q icon. And of course we're going to add here the exit dot PNG and then exit right here. Now what we need to do is to add these into the toolbar that we just created. So to do that, we need to call toolbar. And then we're going to use the add action method. We're going to add up and, and of course we're going to add also the exit. Now if we go ahead and run this, we're going to get something like that. And as we can see, we have our exit here. And however, this up and is not is not open, it's safe. So let me just change this because we are using safe instead of open now, phi go ahead and close this and run it again. I'm gonna get save and exit as we can see. Now whenever we hover over one of them, we're going to see what it stands for. For example, here we have open at this, we have exit. So this is basically for how to use a cue action or how to create a queue icon inside our toolbar. Now what you need to do is to add some action triggers and to these on order for us to, for example, exit from here. So let's suppose we need to exit. One way to do that is to actually add credit here. So we're going to add toolbar, action triggered, and we're going to trigger the action, cue action. And then followed by dot connect. So we're going to connect it to a new function. I'm going to name it exit. And this function would be responsible for us too. Get out of this up. So I'm going to name it exit. And we're going to simply you assess or up, but quit. Quit. And who got? Now, as we can see, if I go ahead and run this, we're going to get something like this. However, if I press on any of these icons, we're going to exit because what we actually did is that she specified that whenever we have an action that is triggered, we need to access. So for example, if I press on this, I'm going to exit. And if I run this code again and press on open, we're going to also access from the app. And this is because both buttons are considered action triggered. Now one way to deal with that is instead of getting all of the toolbar to be action triggered, we can actually specify that we need the exit. So if the exit is triggered, so we have this function but triggered, and we're going to connect it to the exit function right here. So now what you can do is to simply quit the app. So that's it basically now if we go ahead and run this code, we're going to get something like that. If I press on Save, nothing will happen. However, if I press on this right here, we're going to end our Piketty five application. So this is it basically for the tool bar that we have n Pi codifies. We do have lots of methods such as the add action method, and we have used it right here. Now. We also have the set moveable to make the toolbar movable. And we can maybe do it right away. So let me just, after creating the toolbar, I'm going to USD set movable right here. And if I run this again, we need to add his true, sorry. Now, if we run this, we're going to get something like that and we can move it to here or here. So that's it. Basically this is the main functions or the main methods that you can use and dequeue toolbar class in Piketty five. So that being said, this is the end of this video. See you in the next one. 17. Input Dialog: Hello and welcome back. In this video, we're going to talk about the Q input dialog class that we have in Piketty five. So to start, we just copied the blank screen or a blank window that we can create using a queue widget. Then what we're gonna do is to actually ask the user to enter his name. So to do that, what we're going to create at first is a form layout. So I'm going to name it form. And we're going to use a form layout to just created an ad, everything into it. Now what we're going to do is to simply create a queue line added to let the user enter the name, for example. So to do that, what we're going to do is to simply create a line edit. I'm going to name it Line 1. So it's going to be a line edit. And now what we're gonna do is to add this into our form. So form dot, add widget, going to add line one. And then we're going to add or set the layout of our window to be this form that we just created. Now if we go ahead and run this, we're going to get something like this where the user can write or do anything he wants. Now, let's add a label here. However, we're not going to use the Add label method that we have in Pike 35. We are actually going to use a button to show that the user can press on this button. And then we're going to pop up a new window where the user can also enter his name. So let me just show you how we can do that. After creating the line edit. What we're gonna do now is to simply add right here the button. I'm going to name it Button 1 and 2 PDF type q push button. And we can use enter your name. And after that, what we're gonna do is to add it to the form. However, we need to add it with the actual button. So instead of adding it as add widget, we're going to use Add row. And inside this row we're going to have Button 1 and line 1 altogether. Run again. We're going to see something like that until your name and we have something here. Now, if we press on this enter name, nothing will happen. However, we wish to have a new window where the user can also enter the name. And in this case, what we can do actually is to just use the collect function that we have. So if this button or whenever this button is clicked, we're going to connect it to a function that is enter name. And we're going to create a criteria. So let me go ahead and do it. The fern and name. And inside this, what we're gonna do now is to simply use the Q input dialogue right here. So what we're going to do is to get name and okay, and we're going to create a queue input dialog. And here we're going to use the getText method to get a text from the user. So we're going to use that gets taxed. And then we're going to simply name it Input Dialog, followed by simply enter your name here. Now, we're going to explain what this name and or caisson stand for in a second. But for now, FOK is equal to true. Then what we're gonna do is to simply just set whatever we have inside this name and to line one that we have. So we're going to have line 1 dot setText, going to use the setText method. And we're going to store name in it. Now if we go ahead and run this, right, so if I press on this, all right, so we have an error because we didn't specify the queue which adhere. So we're using Ws dq widget. Now let's try it again. Try it out. If I press on here, we're going to get something like this until your name here. And this is the title Emperor direct that we just wrote down. We have enter a name here. So if I type Hadi and I press on, okay, I'm gonna see it here. Now if I write, for example, Eunice and oppressed cancelled, nothing will happen because we specified that if the user presses on a K, We're going to set the text of line 12 out of we have inside our name. If this is not the case, if the user presses on, Cancel or close, nothing will happen and the name won't be changed. So that's it. Basically this is for to ask the user how you can enter the name and get it from another one to the first one. Now let's suppose we need to change the text to an integer. In this case, we need to ask the user for his age, for example. And what we can do actually is to maybe, let me just comment this out and I'm going to create a new button. 12 will be of type q push button and enter your age. Now what we're gonna do is to simply change this function into enter age. And I'm going to create a new function that is enter age. And we're gonna get also age. And okay, as before, however, now we're going to use the get int function with the W as a widget. And of course we are going to have the two strings, the title and the label. So it's going to be an input dialog and maybe just enter your age here. And now if, as before, so if, okay, we're going to change line 1 and 2 setText to whatever we have inside our age. So that's it basically now if I go ahead and run this again, going to get something like that, enter age of our personnel who are going to have this. We can change the age, the integer by using these arrows. And we can also change it by writing down right here. Now what we can do, let me just change this into STR because even though it is an age, we are getting back a string. So now if I go ahead and run this, then we just type something here. And if I press on, okay, we're gonna get the number here. However, if I present cancel, nothing will happen. Now, as we can see, if I tried to write on the keyboard, nothing will happen because this is an integer only. Were they using can't just write everything he wants. And this is a great method to let the user, or to specify that the user can't write anything but an integer. So now this is a great method. So if I tried to write anything but an integer, nothing will happen. And one way to improve this is to actually, as you can see, if I type anything here, they will pop up. And it's not convenient because we just created this in order to prevent the user to write something here. And we can actually disable this line edit. So I'm going to use line one that said disabled, and we're going to use drew. Now, I'll go ahead and run this again. We can see that this is disabled and the user can press or can't write anything here. However, if he writes here, it will pop up inside this disabled line at it. So this is a great way to make sure that we get an integer back and we don't have to worry about the type that we're getting. Now let's suppose we have a list of items and the user is prompted to choose one of them. And this is a great way to use the Q line edit or dq input dialog, I'm sorry, in this case. So what we're gonna do is to just ask the user to enter maybe the category. And of course we're going to connect it to enter category. And we're going to create the function respectively. So we have enter category. And we're going to get, sorry, we're gonna get category, okay? As usual. So category, okay. And we're gonna use the Q input dialog. However, we're going to use the get item in this case function, and this will take a few parameters. So the first one is going to be the title. As usual, I'm sorry, the widget. And then we have the title. And of course, we're going to use and, or choose a category. And then we're going to add a category list. And of course, we're going to start with it right here. So I'm going to name it categories in this case. And maybe that one. And then we have got two. So on and so forth. So maybe really, and now we're going to add it here. So we have categories and we're going to have the index at 0. And we're going to specify to be false, and I'll explain in a second. But for now, we're going to simply write F, okay? If the user presses on, okay, we're going to set the text of line 1. So line one, that setText. Alright, so setText to whatever we have inside the category. And we're good. Now if I go ahead and run this right here, and I press one Enter category, I'm going to get something like this. We have choose a category. If I press on it, I'm gonna get that one cat to get three. And I can choose between them. Now, if I change the index here for, let's suppose I have it at index to run this again, We're gonna get something like that, indicating that we're going to start with get three instead of cat one as before. Now, let's go ahead and choose a category and press on. Okay? And as you can see, we can see it right here, Category 2. So that's it basically for the Q input dialogue. We do have lots of other inputs or not some other functions. And one similar function to the get integer is to get double. We can go ahead and implement it, but I don't think it is much different than just integer. We can use it, for example, to write their salary. And we can simply implemented. And we can also store the input or the input of the user inside our line one edit. So we do have lots of methods. And these are the most important ones that you should know about then dq Input Dialog class. So that being said, this is the end of this class. See you in the next one. 18. Font Dialog: Hello and welcome back. In this video, we're going to talk about the Q font dialog class inside our sacrifice. So let me just start with creating the coupon dialogue right here. And what we're going to do is to simply copy all of this as usual. And after that we're going to copy the application, followed by the WHO system that exit at the end of it. Now what we're gonna do is to start with, let me just close these. And we're going to start by creating some push buttons and the actual maybe tax that we need to have. So to do that, what I'm going to start with is to create a box of QV box. We're going to use it in a minute. Q V box layout. And then what we're going to do is to create a button, one from q push button. And this will be the font. So please select the font you want to use. For example. After that, what we're gonna do is to create a function that is just called whenever we click on this button. So we're going to use that, collect that connect to a function. I'm going to name it set font, right? So I'm going to create it here. So set font, and we're gonna deal with that later. But for now we'll just continue with this. So I'm going to add the widget. So I'm going to add button wanted a box. And then we sit, we're going to simply set the layout of our widget to be this actual box that we have. Now, in order to continue with our set font method that we just created, we need to actually use the queue font dialogue that we have. And this will allow us to get the font information from the user. So before that, let me just, let's say that we want the font of something. So we, for, that we could have used, for example, the set font function that we have and we can select it. So let me just give you an example here. I'm going to create a label. And it will be of Q label. And inside this label, I'm going to have, for example, this is the first label. And after that, what I'm going to do is to set the font to let suppose I needed area and maybe 25 pixels. Now if we go ahead and run it, limb just type Python coupon dialog dot py. We're going to get something like this. And whenever I press on it, nothing will happen because we didn't actually create the function that we have. So let me just run it again. All right, so we do have an error because we forgot to here a queue font. And now we should be good. And again, we're gonna get something like that. And as we can see, this is okay, but we didn't actually add this into our box. So let me just add really quick. So add widget and we're going to use label. And finally, if I run it again, we're going to see it. This is the first labor and it's clearly changing with the font that we are putting here. So for example, if I place 13 and run, we can see that this is the first label is now actually smaller than before. And because this is because we are changing the font, now, Dequeue font dialog will allow us to do so without being, without having to use the set font dynamically, we can let the user choose the actual font. So we're going to call this function, that is the set font. And inside this function we're going to start with that in the font. And okay, from the queue fund dialogue that we have and desk phone dialogue. We have nothing in it. And F, Okay, as usual, we're going to set the label that we have, which is labeled to be equal to the front of the label, to be equal to the font that we just get. So this is it basically now we have this method. And now if I go ahead and run this and we forgot to add the get found method. So let me just quick and now far, run it again and present this. We're going to get the select font. And this will allow the user to choose from all the different fonts that we have here. And the font-style, regular, old bold, and the size also, we have underline strike out everything that we need. Writing system, greek, all of the writing systems are available. And that's it. Basically, this is how we can let the user choose the font that the needs. Now, if we press on, okay, this will happen and if I press on, cancel, it will cancel out all of the setting font action. So that's it basically for the SAT phone class. The coupon dialogue that we have in Piketty five. I thought that it is a great class that can be used, especially when we need the user to enter a specific phone. And using this method will allow us to get a real font instead of maybe some errors or mistakes by the user that can be made. And here, he should always pick one and the concise style font. We can add the effects of course, and he can always see the output before. Just finally pressing on the Okay button. So that's it. Basically this is our coupon direct class. We do have some other methods in it, but this is the just, the most important one that we can use and our Piketty five applications from now on. So that being said, this is the end of this video. See you in the next one. 19. File Dialog: Hello and welcome back. In this video we're going to discuss the queue file dialogue class. So let's go ahead and create our script. I'm going to name queue file, dialog, dot py. And I'm going to go ahead and copy all of this importation and then the application. Then finally, the exit and the execution of the app. Now, let's start with building a QV box that we're gonna use later. So we're going to have QV box layout. And this will help us, or this is where we're going to store our file dialogues that we're going to create later on in our Piketty five application. So let's continue by adding some push buttons. So I'm going to go ahead and write Button 1. It's going to be q push button and maybe just choose an image. And now what we're gonna do is to connect this to a method where we're going to get the image from. So b21 dot clicked that connect. And we're going to connect it to maybe get image. And we're going to create a function to get the image from Sean, get a much. And inside this, we're going to use our queue file dialogue. So we're going to get image name. And we're going to use the queue file dialogue in order to extract the image. So we're going to have the W as the widget. And then we're going to have the maybe just append. And here we need to add our path. So I'll go ahead and copy it right now. After that, we need to indicate the just the type of the images. I'm going to go with the PNG. So to do that, you need to write it like this. And let's close it. And this is it basically. Now, what we can basically do is to get this and maybe just copy it into some form of label or image that we can just create later. So this is how we can use the queue file dialogue. Let's continue on. Let's copy this into an actual label that we can have at sea. So having Button 1, Let's create label one for example. And it will be of type q labeled. And maybe just this is a label. And then what we're gonna do is to simply add them to the box that we just create a circuit to add widget Button 1. And then we're going to add another widget that is the labeled one. And of course we need to set the layout of our window. Well, which had to be the sparks that we just created. Now, let's go ahead and run this before Lincoln it to anything. So Q5, dialog dot py. We can see that we got this is a label and we have to choose an image right here. So now if I press on this, We can't see anything because we didn't use the function that is the gut Open file name. And now we should be good. If I go ahead and run this again, we're going to get something like this. And it is open right now. This is our path and we have the exit and save that PNG. And this is what we chose a match files dot PNG. Now what we're gonna do is to simply get this image. So if I choose this one, nothing will happen because I just chose it and save it and image name and didn't really use it. Now what I'm going to do is to set label one. So we're going to set text or we're going to set the plasma because this is an image and this is how we can do it set up whenever we want to use an image. And we're going to set it to queue picks map of the image name that we just got. Now if I go ahead and run this again, we're going to get something like that. I'm going to choose this image for example. And we do have an Arabic as image name as a tuple. So let's go ahead and print it out. And if I run this, and let's try to use this, we can see that this is what we're getting back. However, we just need the first part, which is fine name at 0 in this case. And I think we should be good. Let's go ahead and run it again. And now if I go ahead and choose, All right, so we got it here. So this is our image which shows it from here. And every time we change or choose another image, we're going to get what we want and it's going to be sold in our label. Now as we can see, we already pre-defined that we just need the PNG photos. Let's suppose. I typed, Hey here, JPEG and I specified that this is the path that I want. Now if I go ahead and run this code, we're not going to find any image just right here because we don't have any images for the type of JPEG. We just have the PNG inside this folder. So we can see the PNG because the only file allowed as JPEG. So that's it basically for the image storing process. This is how we can just choose an image and get it extracted, maybe use it in our pie, purified, or do anything else with it. So that's basically it for the image. Let's go ahead and continue with the text file. Let's suppose that we have dot TXT file where we need to extract some information and show it in our past 35 application. So let's go ahead and do it right here. I'm going to just get these commented out and let's work from here. Now on. All right, so I'm going to create button one. And it's going to be a cube push-button. And these are going to say choose a file. Then what we're gonna do is to connect it into the method that we need. And which is GET taxed may be. And now what we're gonna do is to simply add this into the box. So we're going to add widget. And this is Button 1. And then also we're going to add the content, which is basically you can maybe do it also a label. So label one will be of Q label. And maybe you're going to start with this as a label and also add it to the box. And then we're just going to set out the layout to be this box. Now, we're going to create the function that is the gut. The next function. Now inside this function, what we're gonna do is to extract the information from the text file. And we're going to use the queue file dialogue as before. So let me go ahead and close this. We're going to start by creating the file dialogue. So maybe I'm going to name it file that looks like this. And it will be of type q File dialog. And then what we're gonna do is to set the file mode to any file. So file dialogue that set file mode. And this will allow us to just set the file mode to be any phi that we have. It doesn't matter. So we're going to use any file function from Q5 dialogue. Then what we're gonna do is to filter out all of the files just to have the TXT. So we're going to use File dialog dot set filter. And then we're going to use text files to be just this one, dxdy. And now what we're gonna do is to simply get these into a string and just open the file, read the data from it, and then maybe set the text of our label to be the data that we're going to extract from the file. All right, so to do that, what we're going to start with is just maybe I'm going to name them files. And this will be defined dialogue that selected files. So this will extract all of the files that we have. And then what we're going to do is to open maybe the first file, since we just need one of them. So we're going to open the files at 0 and we're going to read. All right, so now what we're going to do is to use this and set the text of the label to be data that we're going to read. So we're going to be having defiles and string list. So before getting the selected files, when I'm going to do is to create a queue string list model. And this will allow us to store all of the files in a source of strength list. And then what we're going to do is to simply open them and get the first one and then read the data from it. Now what we're gonna do is to simply use it and store the data from here inside the label one. So level 1 dot set text into that breed. And this will allow us to read the data and get everything from here and setting inside this label. Now what we're gonna do is to run this and check it out. So I'm going to have to run it here. Choose a file. All right, so we have an error saying that this, alright, so we need to use a setName filter. Because this was the older version. Run it again, choose a file. And we do have list index out of range. And this is because the opening of files might be too slow. The selected files to be sought inside this string list is, might be too slow. So we're going to run an event loop using the just File dialog dot execute. And this will allow us to wait until we get the file and then we can continue. So this is basically and of course, this should be also inside this one. All right, so I think we're good now, if we go ahead and try to run this again, we're going to see something like this. If I choose a file, it will open up. And if I press on this and open this file, gonna see it right here. This is the first file, file.txt hello world. And these are the exact same thing that we wrote and our file.txt right here. So that's it. Basically this is how we can extract from a file using a simple method, that is the queue file dialogue class. And, and what we did exactly is to just create a button. And then whenever we press on this, it will allow us to use this getText function. And inside this getText function, we created the file dialogue. And we specify that we can take any file, then we just filtering out into dot TXT. And then when we got this file, we created a string list model where we're going to store all of the filenames. And then what we actually did is to get these files and store them inside our files from the file dialect and open up the first one in the list. And of course after that, we just got the data from this file using the method read and set the label to be this data that we just extracted. So that's it basically for this queue file, it direct class. That is a very powerful class in pica 35. With that being said, this is the end of it. See you in the next video. 20. Tab: Hello and welcome back. In this video we're going to talk about the Queue tab class. And let me go ahead and create our function, our script here. So we're going to name it the queue. Now pi. Then let's start by importing everything that we have from previous scripts. So I'm going to do this. And then we're going to take the AP criteria. And then finally, topples. Now what we're gonna do is to actually use the Queue tab widget instead of the actual widget. And this is something we use whenever we need to have a top and our application. Now, what we're going to do is to create some tabs. So I'm going to create two tabs. The first one will be named T1, and then the second one will be T2. And they are both of class Queue widget. And then what we're going to do is to just add these tabs to our queue tab widget. So w dot add tab going to T1 and T2. And now if we go ahead and want to visualize this, we can simply do so by finally. Let me just go right here and run this Python dot py. All right, so we do have an error because at self-care widget, an STR. So we're going to hear the name, which is basically tap 1. And here we're going to add that thing. Now we're good. Let's go ahead and again. And as you can see, we have TB1 at two and we can toggle between them. Now inside these tabs, we can do whatever we want. But for the sake of example, we're going to maybe add firstName and lastName with some line at it where the user can just add a few things. And to do that, we're going to simply use the function. So let me just created right here. So this function is going to be named tab1. So T1 or maybe TB1. The sake of the argument. And what we're gonna do is to simply create a form that will be q for layout. And then what we're going to do next is to add maybe firstName and lastName with a Cula and edit. So I'm going to need to create maybe a label. So I'm going to name it labeled one. It will be of Q label. And I'm going to write first name. Then we have Q line edit. And we're going to name it Line 1. It will be Q line at it as this. And then we're going to add these to a row where we have labeled 1 and line 1. And then we're going to do the exact same thing for the last name. So q labeled last name. And then we have line to that will be of type q line edit as usual. And dust just added to the form that we just created. So label to line 2. I think now we're good. We can simply just add these to our layout. So as we can see, this is for the tab one. So what we need to do now is to use are added to t1. So t1, that, and we're going to use the set layout to be this form that we just created. Now if we go ahead and run this, we're going to see something like that. We do have. Here are a few things. However, we can't really visualize this because we didn't really call the function. So I'm going to call it right here. Now, let's run again. And as you can see, we got our firstName, lastName, where the user can enter the information here. And we can do exactly the same thing here. We can maybe add q radio buttons, checkboxes, maybe some file input or anything that we want or need. So that's it basically for this cute IF function. If you're interested in maybe implementing an extra tab here, I'm going to continue maybe to add some categories that the user can choose from. Maybe some queue checkbox, let's say. And this is it for the tab. If you're interested, you can continue with me with the studio. So now for tab2, when I'm going to do is to create another function here, the AP2. And inside this function, I'm going to also create another form layout. And maybe let's change from the formula and I'm going to create a QH box layout. So I'm going to name it books of type QH box layout. And we're going to add the labels. So let's suppose I have a label one for category one. So it would be of type q labeled Category 1, then label two for category two. And finally, labour 34, category 3. All right, so now we're good. What we need to do now is to simply add them to our box. So at widget, going to add label one, and then we're going to add labeled 2. And finally, we're going to add labor 3. Now, as before, we're just going to set the layout of our second tab to this actual box. And we need to add up to and call it to just generate this function. Now, we do have these three labels. We can change them actually to the checkbox for example. So if I want to visualize, checkbox will have to do them like this. And now if I go ahead and run this, we're going to get something like that. We have to have one of the present up to going to get this. And I can choose. Some of the textboxes are checkboxes that we have. And this is all using some tabs so we can toggle between them and they are. For each tab we have different purposes and different methods that can be generated and you work with. So that's it basically for the cutup plus nPi codifies. This is the end of this class. We do have lots of methods that we can use and these are the most important one. Now, the last thing I'm going to show you in this class is the current changed method. This will allow us to know whenever we change the index or whenever we change a tab to another tab. So I'm going to do is to just use it. So whenever we do have the current changed, we're going to connect it to a method or a tab changed. Now if we go ahead and create a function that is called Tab changed, we're going to print that. We changed the apps right now. So now if I go ahead and run this again, and if I change from here to here, we can see that each time I change or toggle between the tabs, I'm going to get we changed the apps right now. Now we also have another function that is to get the current index. So one way to actually get it is to simply use it right here. So we change the tabs right now. Two and plus, we're going to use the top or W, that current index. And this will allow us to get the current index that we have. And if I run this, right, so we need to concatenate it in a string. Run again. Thus we can see we get this and we are at index 0. If I move to index 1, 0, 1, 0, 1, and so on. Now we can also have the current index and we can set it before starting the process. And we can use this set current index I specified to be one to get to tap into, since we only have two tabs, this is at index 0 and this is at index one. So we're going to run again. And as you can see, we started out at Tab one now, and I'm sorry, it up to which is at index one. And we can move back and forth. The steps does, That's it basically for the cute up, we do have lots of methods that you can use, such as the set current widget, removed up, Insert tab and set that position maybe just above the page, left of the page, below the page of these functions might be useful for you depending on the case. But these are the most important ones that you need to know before starting with some Piketty five application. So that's it basically for the q tau plus. With that being said, this is the end of this video. See you in the next one. 21. Stack: Hello and welcome back. In this video, we're going talk about the cue stack class. And let's go ahead and create our file. I'm going to name it Q stack apart. And as before, we're going to simply copy this and a few of these from here. And then we're going to show the window and exit the system. So that said basically for a basic by 35 application now let's start with building the stack that we want. Now to do that, we need to use dq stack, which class that we have. So I'm going to name it stack. And it will be Q stacked widget. And this will be the main stack that we need to create. Now what we're gonna do is to simply change this from Q with their budget to Q2 budget. And of course, we're going to need to create multiple stacks and then add them to this Q stack widget and then show them an hour window. So to do that, I'm going to create a S1, which is a Q widget. And then S2, another key which it. And I think That's enough. Now what we're gonna do is to add this into our stack widget. And to do that we can simply use here stack that add widget. And we're going to add S1. Then we're going to add S2. And after that, we're going to create maybe just some sort of a layout and simply put the switches into it. So I'm going to create a horizontal box. I'm going to name it box Q H box layout. And then we're going to add the stack into this box using the bugs that add widget. And we're going to add stack. And finally, we're going to set the layout of our window to be the box that we just created. Now let's go ahead and run this. I'm going to run Python q star octopi. Right? So we do have an error. And this is because we didn't add as to here. Now I think we're good. Let's run again. And we got our widgets. Now, what we actually need to do is to simply just add some information to them. So we're going to create a few stacks or a few functions that will allow us to add some information to this SASA we just created. So let's go ahead and do it. Right here. I'm going to create the function that is for stack one. And in this function, I'm going to just create a form, you form layout. And then what we're gonna do is to add the firstName and lastName, just as we did for DQ data. So first name is going to be of Q label. And this will be just name or maybe firstName. And then we're going to have lastName, which is Q label to. Let me delete this equal from here. So this ACU label for last name. And then we do have the line at it. So line 1 is going to be equal to q line Edit. And then line two is also going to be equal to another Q line Edit. And then what we're gonna do is to add these to the form in a sort of row. We have firstName with its corresponding line, which Islam one, and then another row with the last name plus line 2. And we get now. So that's it. Basically this is our form. Now what we need to do is to simply set delay out of our first step to be this, right? So we do that by simply adding s1 dot set layout to be this form that we just created. So now this is for stack one. We can do the exact same for stat to before trying to display it. So we do have staff to right here. And maybe let me just copy the same code and changed a few lines for here. So I'm going to get this and set it here. And what we're going to do is to simply change the layout of S2. And this, for example, we will be first second, just to change names, to know that we changed the stacks whenever we just run this code. Now if we go ahead and run this, as we can see, we can see anything for now because we didn't add any list that will allow us pseudocode toggle between these tags. And one way to do that is to simply use the cue list widget. And this will be a list on the left of the screen where you can toggle between the stacks and choose one of them. So let's go ahead and implement it. So after creating the widgets, but we can actually do is to create a list of type cue, list widget. And this list will allow us to have a few things right here. We can insert item. And this item will be at index 0, and I'm going to name it stuck one. And then we're going to insert another item. And this should be at index 12 will be stacked two. And now, after inserting these, what we actually going to do is to simply add this into our box I would just created. So before adding the widget stack, we're going to add here the actual list that we just created. Now, let's go ahead and run this. And we're going to see something like that. We do have stuck one and step two and we can toggle between. But we can't just see the actual stack that we just created yet. And this is actually because we didn't actually call these functions right here. So let me go ahead and do it after creating the list. And we can do it here, for example. I'm going to do stack one. And then we're going to use stack two. And now let's go ahead and run this again. And we can see that we got our stack. We do have stack one, which is for firstName and lastName. Then we do have stack two. And of course, nothing will happen for now because we didn't actually toggle between or change anything whenever we press on-site to or unstack one. And we need to do a function that does this work for us right here. So how do we do it? We can simply use the current row changed method that we just have. And this will allow us to toggle between the taxes, this stacks that we just created. And to do that, we're going to say that whenever we have anything from the list. So if the list that, and we're going to use here dysfunction current row changed. We're going to connect it to a function that togas or changes the actual stack. We're going to name it stack changing. And we're going to create the function writer. Sure, stack changing. And this will allow us to toggle between the different stacks that we have. And in this case, what we're gonna do is to simply add stack, the style that we just created from here. And we're going to set the current index to the index that we're going to get from this one right here. So to get the index that we have from the list, we can use simply list dot current row. And we got now, so if I go ahead and run this again, we're going to get something like that. So we are stuck. One, if I press on step two, we're going to change. So we have stack one, FirstName, LastName, stack to first. Second, as we can see, we toggle between these tasks using this list. So let me go ahead and do a quick recap right here. So what you first created, The stacks that we just have, stack one and step two. Then we created a cue list widget. Add these into it, indicating that this is stack one and this is that two. And then whenever we press on any of these on the list, we, what we just did as to call this function that is stacked changing and then get the index at which we are in the list. For example, here we are at index 0. So we go to Stat changing and we set the stack that we just created, which is right here, where we added our S1 and S2 and change the index accordingly. So if you are at index 0 on the stack, we're going to have here from the stack the information of stack one which is at index 0. So if we change this list to index one, which is stacked two, we're going to get whatever we have inside the stack at index one, which is actually this stack to which that we just created. So that's it. Basically this is how we can toggle between stacks. You can do lots of things with them. And this is just basically the basic layout that we can create using DQ sta, which at that we have in Pike modified. So that's it basically for this video. See you in the next one. 22. Splitter: Hello and welcome back. In this video, we're going to go through the splitter class in Python file. It is a simple yet advanced class or we have. So let's go ahead and created so Q split of the pie. And what we're gonna do is, as usual, we're going to copy the imputations. And then we're going to create the app and simply show it and just executing the app. Now what we can do is to actually create a few things. So I'm going to create maybe two or three q line adults where we do have or maybe just create a tax credit. So let me go ahead and do it here. So we're going to have a T1 for textile to text edit one of type q text edit. And we can set text into this as T1. Then we're going to have T2, which is also Q text edit. And I'm going to set the text into this as T2. And finally T3, which is also Q texts added. And this will be this as T3. Alright, so now we're good. We do have all of our text edits. And what we're going to use is a queue splitter. This Q splitter is actually going to be the one that cuts the window into whatever we want. So we do have two things. It can be either horizontal or vertical. So let me just demonstrated and the example, I'm going to name it as one indicating this splitter, one going to use q splitter, and I'm going to use q t dot horizontal to just split our window horizontally. Now what we're gonna do is to add widgets into this splitter. So s1 dot add widget. I'm going to add t1 and then I'm going to add 32. So s1 dot ADD t2. And then what we're going to do is to simply set the layout of this to be inside our window. And to do that, we actually need a box salami. Just go ahead and create a really quick here. I'm going to use a horizontal box for this. So QH parks, and this will be our box and we're going to simply add to it using the Add widget. So add widget. And we're going to add a swan. And then we're going to show it or set the layout of our window to be the spokes are we just created? Now if we go ahead and run this. So Q splitter, no pie. Or getting at something like this. We do have this as T1 and T2. And as you can see, there are split in half because we use the splitter horizontally. Now as we can see, we just have these two for now. We didn't add this D3 and to any of those. Now what we're gonna do is 2. Simply add maybe another T4. That is a cute excited too. And then we're going to set it to be this is T4. And what we're going to do now is to create another layer that is also horizontal. So I'm going to name it Q splitter. And this will allow us to have QT also dot horizontal. And now what we can also do is to add these widgets. So t3, and I'm going to add t4 to it. And then we're going to add it to our box. So if we add criteria, so add widget and we're going to add two to it. Now, if we go ahead and run this again, we can see that we get multiple widgets or multiple just tax audits that are just horizontally, it shatters. Now what we can actually do is to take these two and place them down here. So instead of having them all of these fours on the same probe, we can actually have T1, T2, T3, and T4 right here. And one way to do that is to use these better vertically. So what I'm going to do here is to use S2 to be the splitter tab we're just going to create or maybe S3. Let me create another spinner. And this will be q t dot vertical. And this will allow us to store the first better and then the second sputter on top of each other. So I'm going to add to this. So I'm going to add widget and add a swan. And I'm going to add S2. Now instead of adding these switches S1 and S2 to the box, we are going to simply add the S3 that we just created. So box that, add widget, then add S3. Now let me just close this and run it again. We can see now that we have our four tax adults and they are better looking than the ones before. So what we actually did is that we created three sputters. The first one is horizontal to add T1 and T2. And this form we have T1 and T2, they are horizontal. And then we do have another sputter asked to add T3 and T4 as we can see. And then after that, we used a vertical sputter to add S1 and S2. And remember that t1 and t2 forms as one, T3 and T4 forms as two. So we have T1, which is this right here. And we have as to which has also this. And we added them vertically using S3 splitter. And then what we actually did is that we added the whole S3 sputter into the box or we just created. All right, so this is the QRS Player widget class and pi 35, it is simply at advanced one. You can do lots of things with it. You can maybe change these tax credits and to anything you want. And it is a very powerful function that you can use and it will be a great plus 2 the Piketty five applications that we're going to create later on. So with that being said, this is the end of the skews player class. See you in the next video. 23. Dock: Hello and welcome back. In this video we're going to talk about the Q dot class that we have, n pi 35. So let's go ahead and start our application. I'm going to create a Q application, sys.path, RGB as usual. Then I'm going to create a queue main window and emit w. And then what I'm going to do is to simply show it. And after that, I'm going to exit the system by executing the application. Now what we're going to do is to create maybe some sorts of bugs. I'm going to simply create a QH box for now. And then what I'm going to right now is maybe a menu bar just to show a screen with a simple or basic elements. So I'm going to name it MB menu bar, and this will be w.menu bar as usual. Now what we're gonna do is to add a few things to it for. So for example, I'm going to add first. Two will be Mp that adds menu. And this will be first. And then we have second and B.me, second. Now if we want to see this, what we can actually do is to simply add this menu bar into the actual layout or the actual window that we have. So do that, we can simply add it by, let me just add the layout right here. And notice that we don't really need this for now because we create the menu bar from the window. So for example, if I go ahead and try it here and run this, I'm going to get something like this. A mirror on Python, q doc. Alright, so we have first, second, and everything. Looks good. Now, let's just close this and try again. All right, so this is our application for now. Now, what we're gonna do is to create a queue duck widget. So I'm going to go ahead and create it here. I'm going to name it duck. It will be of class Queue duck widget. And I'm gonna name it you doc for simplicity. So this is our CUDA Tk widget. Now, what we're gonna do next is maybe create a list of widgets and add some items to them. So for example, we can create a list. I'm going to name it list, coolest Q widget. And this will allow us to simply add some items to it. So listed Add Item, going to name it one, list, item two. And finally adjusted add item. And this is item three. And finally the last one will be four, so we have four items. Now what we're gonna do is to simply set the widget of our dock widget to be this actual list that we just created. So to do that, we can simply set widget and we're going to set the budget to be the actual list that we just created. And after that, let me just run this again. Let's close. All right, so we do have the queue layout and we didn't have we didn't have the queue dock. And this is because we didn't add this into the screen. So one way to do that, we can simply add it by using w that add doc widget. And we can actually specify its position. So we do have the left doc widget area, right doc dot, top, doc bottom and not occur. So we're going to maybe go with left doc, which IT area in this case. And this will allow us to get, all right, so we can simply press Q, t and then left doc widget area. All right, So we're good now we do have our area and we're going to add the dark criteria that we just created. And after that, we can simply run our code again. And as we can see, we got our q dot right here. We have our items. Now if I press on it or double-click on it, I can move it For away from the screen. And if I double-click on it again, I'm gonna get it back. And our screen. Now as you can see, because we didn't have anything else in our area, even though we specify that it should be on the left side, it took all of the screen and this is because we have nothing else to show. So if we go ahead and maybe an add, anything right here, Let's suppose I want attacks Edit. Then I can go ahead and add it and it will appear, and this will get to the left side of the area. Now we do have some other functions. And one of them is the set features. And this is to set the feature of the dock window. We can make it closable, movable, floatable. And we do have the doc widget vertical title bar. And we also have the no doc which AT features. And this will allow us to have no features and our doc for now. And this is it basically this is four, this is it for the Q dot class and Piketty five. It is a great class to use, especially when we do need to move some dogs and maybe create multiple screens that can move and do anything with them. So that's it basically for this video. See you in the next one. 24. Scroll Bar: All right, so in this video we're going to discuss the queue scrollbar class and Pi purified. So let's go ahead and created, we're going to create a script name cuz scroll bar pie. And in the script we're going to import everything that we have here. And then simply create the application using a simple cue application. And we're going to change the main window it to a queue, which it for now. And then of course we're going to show it and exit the system by executing the app. All right, so now we're good. We can start with our main application towards I'm going to do is to simply create a queue VBox. So I'm going to have Q VBox layout. And inside this box we're going to have a couple of things. So the first thing that I'm going to do is to maybe just create a simple scroll bar that just we can see. So we're going to create it. I'm going to name a scroll bar. And it will be of type scroll bar. And we're good. Now what we're gonna do is to simply add it to the box that we had. So box dot add widget. And I'm going to add this speed to it. And of course after that, we're going to simply set the layout of our window to be this sum just created. Right? So let me go ahead and run this just to have an idea of where we've built. Tell now it does. We can see we got our scroll bar right here. And now if we increase it, we can increase the length of it right here. So let me just set the geometry of the window into 500s. And that's trying again. And we're gonna get something like that. Alright, so now we do have two functions that we can use and this juice crowbar class, the first one is the slider moved, and the second one is the value changed. And we usually use the slider moved whenever we want to know if they use at the slide. On the other hand, the value changed is usually used if we want to know if the scroll bars value changed. So in other words, if we want to know whenever the value is changing, even though the user hadn't just released the slider yet. We need to use the slider moved and devalued change is whenever the user actually releases the slider. So let us go ahead and implement some of the functions. So for example, we're going to start with the slider moved. And in this case, let me just use it here. Moved. And in this case we're going to connect it to a function that is Slider mover. And I'm going to create it here. So slider moving and we're going to simply print the value of our interval. All right, so we have here the slider moving. And in this case, we can actually just return the slider that we have and simply print its value. We don't really need to deal with here, but we can do it. I'm going to print here Sb that value. And now if we go ahead and run this, we're gonna get our slider or scrollbar. And in this case, whenever I press on it and move it, I'm gonna get this right here, even though I didn't release it yet. And we do have all the values from 0 to a 100 because it is the default one. We can always change it. Our set the maximum, minimum according to our needs. But for now this is the slider moved method. Now let's go ahead and maybe use the value changed. So I'm going to try the values change does connect and maybe value changing. And in this case I'm going to create a function named value changing right here. And simply print the value of the scroll bar that we have. And if we go ahead and run this again, we're going to see that it has exactly the same as the one before. And that's it basically, this is it. If I go ahead and run this again, for this one, we're going to see that it has exactly the same as we said. And we're gonna get the values whenever we change or whenever we scroll using this scroll bar that we have. So that's it. Basically this is one of the most important classes and 35, because it allows you to do multiple things, may be just drag these and that the user choose and trade, for example, anything. So it has many uses and it's very powerful. With that being said, this is the end of this class. And see you in the next video. 25. Status Bar: Hello and welcome back. In this video, we will discuss the queue status per class in Python 35. So let's go ahead and start our application by using Q application as usual. And then we're going to create our window. We should be a q main window. And of course we're going to show it and execute the app. But exiting before. All right, so we're good now we can start with our application. What we're gonna do is maybe to start with something simple as before, we're going to create a menu bar. So we can create a menu bar from the window that we just had. And what we're gonna do is to simply add some menu to it. So I'm going to add menu first and maybe second. And I'm going to add few action to this first, so I'm going to name it first here. So I can access it later on. And here I can access it using Add action. I'm going to add, maybe, I don't know, maybe add text and I'm gonna delete text. So these are the actions that we have in our menu bar. So we do have attacks or delete text. And what we're gonna do now is to create a queue status bar where we can have either show this text or not in a text edit or aligned edit that we can just create. So let's go ahead and do that. And what we're going to basically do is to create a status bar as B and it should be acute status bar as this. And what we're going to do is to simply set the window to be the status bar. So set status bar to be SP. Alright, so now we're good. We do have our status bar. However, we need a method to trigger it. And this method will be actually whenever we press on something that is on this first. So we do have first triggered and we do have a queue action here. So whenever we click on something on this first, we're going to connect it to a function that we're going to create and that does the work for us. And in this case I'm going to name it. May we first collect. All right, so we can create our function here. First clicked. And we print hello for now, just to note that it is working, Ashley. So if I go ahead now and run this, I'm going to get something like that. And whenever I press on attacks or a D tax, we're going to get hello and both of them. So this is it basically for now, for present second or first, nothing will happen. However, if I press on these actions that we have here, we're going to get printed. Hello. Now what we're going to do actually is to maybe add a text edit. And in this text edit, we can actually just add a text or deleted according to these actions that we have for IT. So to do that, we can actually set the tax added into the actual window that we have. So we have w. And I'm going to go ahead and set central widget to be a text edit. And I'm going to name it taxed at the price here. It will be acute text edit. And I'm going to add it here. And then what we can have here. If I run this again, we're going to get something like that. We do have a text editor, we can write something here. Now what we're gonna do is to simply add a few lines. If we do press on the ad text and maybe delete them if we press on the delete text action. So what we're going to do is to actually get some, I'm going to name it maybe W, or the sake of the example. And what we're gonna do, this will allow us to check the text of the actual menu that we got. So if I go ahead and print it here, so that print W dot txt. Now if we go ahead and run this, we're going to get the screen. And if I press on thirst attacks, we're going to get at tax. And the tax, we're also going to get delete text. And as you can see, whenever we press on them, this method is going to be called from the triggered action that we just created right here. Now what we're gonna do is to check if this W dot txt is equal to ad, then we're going to add some lines to the actual text editor we just created. So f, w dot x is equal to maybe add text. And if this is the case, then we're going to add to text edit something. So we're going to set the text to be equal to Hello. This is the first text written here. And then if this is not the case, so if I'm sorry, as we're going to check, if this is equal to delete text. And if this is the case, then simply we're going to add the texts added or set the text into an empty string. So that's it basically now let me just correct this and I think we're good. All right. So that's it. Basically this is our God for now. We just checked if we'd need to add the text or deleted, and we just perform the operation according to the message that we just received. Now let's close this and run it again. And now if I press on first and add texts, we're going to see text written here. And if I deleted, who can see it vanished from here. So this is it basically this is the idea of the queue status bar. And it changes the status of anything of any element in our Piketty five application according to our specific needs. And in this case, we chose that whenever we press on this Add menu, we just created and any action that will perform accordingly. And we can delete, add, and modify our Piketty five applications using this triggered function that we just created for this queue status, bar, glass and Piketty file. So that's it basically for this class. But that being said, this is the end of this video. See you in the next one. 26. Calendar: Hello and welcome back. In this video we're going to discuss dq Telenor class in Parquet file. Let's go ahead and start building it. You're going to create a new script, going to name it Q calendar, the pie. And I'm going to import everything that we have as usual. All right, so we said, now what we're gonna do is to simply built Q, which it. So I'm going to start with the application. As usual q application and System.out ARG V. And then we're going to build the widget from q widget. Alright, then show it. And of course, execute the app. And now we're good. You can start building our calendar. And it is an actual state forward class. Don't have much to do here. We just have the calendar. We can build it using the Q calendar widget. And after that, we're gonna set the grid to visible. And let's go ahead and visualize it. However, before doing so, we need to add this into our w dot window of Q widget. So let's go ahead and run this. And we're going to get something like this. And as we can see, we can't find the current. I would say that we just created because we didn't add a two hour window. Now, one way to do that is to simply add it using a box. So I'm going to create a QV box. And we're going to add this kind of soapbox to add widget. We're going to add calendar. And after that, we're going to set the layout of our window, or which had to be this boss or we just created. Now let's go ahead and run this. We're going to get something like this. We do have our counter inside our box which says the actual layout of our which it does. We can see we can choose any month, any day, and any date at all. You do have the years here. We'll have the month here, and we can just pick any of these. Now to access these actual data, we're just accessing all just pressing on. We do have some methods to do. Now whenever we click on this function, we need to just print out the data we have. And we can do so by simply using the just. And, and this case, we're going to do Q date. And after that, we're going to connect it to the function that we just gotta create. And in this case I'm going to name it, date changed. And we're going to implement that here. So we have date change here, and we're going to print the actual data. We have. So to do that, we're going to print calendar that. And we do have here the selected date. So selected date. And in this case, if I go ahead and run this, let me just close. And again. And now wherever I press on something or any date, we're going to see it right here. Now to format it, we do actually have the dot toString method in Python. Now let's try it again. And we're going to see it is now formatted to the name of the day of the week, then the month, and the day of the month, and the year itself. So that's it. Basically, this is for our actual maybe Q calendar and how to use it. Now, one maybe additional feature that we can have, maybe just have a Q text editor. We just can maybe change each time we press on the date that we'd need. And in this case, we can actually create it here. We do have text added to B of q text edit. And it will be empty at first. We're going to add it to our actual box. Now whenever we change the date, we can actually also change the text, edit that setText, going to set it to calendar, that selected date, that to string. And now if we go back and hit refresh, we're going to see something like that. There's a text edit now if I press on it, we're going to see the dates right here. So that's it. Basically this is for the Q calendar class, is how we can use it and get the dates from the user and Pi codify. So that's it basically for this video. See you in the next one. 27. Drag & Drop: Hello and welcome back. In this video we're going to discuss the drag-and-drop class and park purify this very powerful class where you can just drag something from any element that we have and then just drop it in another element. And we're going to do it in the object oriented way. So I thought, since we're going to start building the projects and we're done with the basic elements or basic widgets. We have. Why not start with building classes and functions and deal with them. So to do that, we're going to create this application using object oriented. Alright, so we're gonna start with our function. That is the main function. So I'm going to simply start by creating the main and dismayed. What we're gonna do is to build our app, which is Q application. And you can follow this format in all of the classes or bulky 25 applications that you're going to create the simple and say forward. So the first thing we're going to do is to put our main function and dysfunction. We're going to create the application and then we're going to create our budget. So I'm going to name now a class. I'm going to name it to budget just for the sake of the argument. So our class is widget and it will take the actual Q which it that we need to create. Now whenever we need a queue widget, we can simply call this class. All right, so I'm going to name it w, and it will be simply q widget. I'm sorry, the class that we just created. And we're good now, we can actually show it and then execute the app. Right? So now we're good. We can start building our function here. So this is the main class that we have now, which is called widget. And now we need to define the constructor of this class. And in Python, we do it this way. We can just call the init and it will do all the work for us. But we don't really need all of these. We can simply use it with self just to, let me just write it and then explain it. So we're going to call the super and simply edit like that. So this is our function basically all deconstructed that we're going to create or we're going to work with. And now we use this self. Now whenever you use the self, we're going to simply be addressing this Q widget that we have right here. So for example, if I say self.name geometry, Let's suppose this will allow us to simply set the geometry of our widget, which is W writer, to be equal to the one that we want. So that's it. Basically this is the idea of this simple cue widget. Our constructed that we have right here. Now what we're gonna do is to simply create a function. And this function will just do the work for us. So the idea of this is to have maybe a line where the user can enter some code and simply drag it and drop it in another line, or maybe a tax at it. So we're going to do it by maybe let me just lined to text. And this will take self as a parameter. And now we can start by creating the line at it. So I'm going to name it Line Edit. And it will be of class q line at it as usual. And this will be an empty. And of course, we're going to need the self right here. And what we're gonna do now is to create another, maybe some sort of elements. Let's suppose we need a tax credit in this case. And I'm going to simply create texts at the criteria. And this text edit will also be maybe nothing and also cells. Now what we're gonna do here is to specify or enable the drug feature inside this line edit. So I'm going to call line edit. And that enabled and, or maybe set drag enabled. All right, so we do have it here true. And now if I call this method that we have right here in the constructor that we just created. Then if I run this code, we're gonna get something like this. If I just increase this length, width. And we can see that we have right here our line at that. And we also have the tax at it. Now what we can actually do is to maybe add them to sort of box and then simply add this or set the layout of our window or widget to be this box as before. So maybe create QH box layout. And now inside this box we're going to add these two. So box that add widget. I'm going to add line edit and bugs that add widget. And we're going to add also the texts added criteria. And then of course, we're going to simply set the layout of our widget. And remember whenever we need to address this widget, we can call selfless at layout. And we're going to address it like this and added to the layout. Now let's run it again. And thus we can see we've got our line added and our text edit right here. Now what we're gonna do is to simply create some function that can connect us for the drag and drop feature. So one function is the drag enter event. And this will allow us to, whenever we maybe type something here and take it and we can drag it and it will save the information for us until we just drop it anywhere else. So let's do that for instance. And for that, we're going to simply build another function or another class. For the drag and drop. I'm going to name it drag drop. And this function will take maybe just a Q tax edit for now. This will allow us to The right into this cube TextEdit. Now what we're gonna do is to simply define the instructor as usual. And instruction we're going to have self who are going to have anything we can name it T for title. And we're going to have the parent from the earliest constructor. Then we're going to call super as usual and an IT. As before, however, we need to ask parameters, the T and parent and I'll explain it in a minute. Now what we're gonna do is to accept the drops here. So we're going to call self that accept. All right, so set except drops and we're going to put a true. And then what we actually need to do. All right, so this is here. And we got, now what we're gonna do is to create the functions that are, maybe we need them to just drag this item or wherever we have the element and drop it in another element. And I'm going to name it that enter event. This is a built in function, but you need to specify everything in it. So let me just write it like that and we're going to work with it. So the first thing we're gonna do is to simply get data. And we're going to check if the data that we're getting is a text and we're going to accept it. Otherwise we're going to just ignore it. So to do that, we're going to use F and D. We're going to use the function, my data. And if the format is actually a text or plane, we're going to simply accepted. So d that accept. Otherwise, we're going to simply ignore. Now this is the main function that we're going to. It's going to decide either we have a plaintext that we can accept, or we just ignore whatever we have inside the element and we ignore the drop event later. Now the drop event is actually another function. And this will allow us to simply drop whatever we have inside our texts or text edit. Yeah. All right, so to do that, we're going to simply call self since we have the Cutex editor. And inside this, we're going to set the text into whatever we have indeed. So the data that dx by dt here, and I think we're good. So sono, what we're gonna do basically is to change this text edit from Cutex added into the class that we just created. Remember that we build the cute excited here inside this class. We have some functions related to this text editor where we can check if the data is taxed and if this is the case and the user dropped anything on this tax edit, we're going to set the text into wherever we have here. And to do that, let me just write this corrected. And what we're gonna do now is to change, as we said. And I change this into drag and drop. And we're going to have it empty at first. And we're going to call self for that. So this is basically this is our classes. Now let's go ahead and run them again. And now as you can see, if I write anything here and just drag it and drop it, we can see it transferred to a. So if I do it again, we're going to get it right here. And of course we can change anything brighter because it is a text edit, the end of the day. Now, this is a great class that we can use in Python. Refine this a bit complicated, but if you just understand the idea and how it works, everything will be fine. So to recap, where we are shaded is that we use object-oriented programming to build this function or towards this pi 35 application. And I did that because I thought that we're going to start with projects soon and we need to be able to work with classes, functions, and not just writing the actual maybe widgets or features and methods that we have. N pi could do five classes. And this is a great way to start. We built the widget that we did. This is w. We build it from here, and we define the constructor. The constructor is nothing but just the start element or whatever we start with inside our class that we built. And this instructed just called the super. It is just main function that should be called. And then what we're gonna do is to simply call whatever function we need. And this is line two texts that we just created here. And this function had several elements that we have. Inside this function, we actually have another class that is the drag drop. So if we go ahead and look at it, we're going to find also similar thing. We do have the constructor. We do have also some functions that we can use. And of course, all of this is accepted because we just set the accept drops to true. And we also said the DAG unable to true here too. So this is it basically this is it for the drag and drop feature or class in Pike purify? So that being said, this is the end of this video. See you in the next one. 28. Qt Designer Download : All right, so in this video we're going to install QT designer. And it is a tool that allows us to create these pike ED50 applications that we've been working with using just drag and drop. We can have our Piketty five applications with different resolutions. Sizes, can change the colors. We can add tax edits, line edits, the widgets that we worked with earlier. We can do all of that using a simple tool. There is the Query Designer. Now to do it, we can write, I should try, Pip, can solve it using pip. By codify. We're going to install by 35 the tools. And I have the query designer in my desktop and, and my case I'm going to see requirements already satisfied. However, in your case, it is going to be downloaded, tried here after it is download this but you can do actually is to write QT designer. And this is the one that we'll be working with. And this will pop up right here. So we can create dialect with buttons, without buttons, and maybe just close it for now. And these are everything that we need. We have the layouts, spacers, buttons, and put widgets. All of the things that we've discussed earlier, such as the line editor, TextEdit, spend box, double-spend box. Now, the next couple of videos we can learn how to use QT designer and design similar biography five applications or do similar features that we've done earlier. And then we're going to start with some applications or some mini-projects that allow us to use multiple features, buttons, widgets from here, and to build a mini-project or many application that we can work with. So that's it basically for this video, this is how we can install this QT designer. See you in the next one. 29. Introduction To Qt Designer : Hi. So in this video we're going to talk about QT designer for a bit. We're going to discuss the windows, such as the widget box that we have right here. We do have some few things here in the menu, and we also have some windows right here. So the first thing we're going to talk about is the Main Menu bar. We do have the file to add new file. And we do have some templates here. For example, we have with buttons, okay, and tensor with buttons, okay? It gets the right here without buttons, main window, and budget. So basically, most of the time we can use the dialogues without buttons. Going to have a simple window such as this one. And wherever you want to save it, you can control and save. And it's going to pop up as the GUI, which is the UI that you are going to create. This QT designer. It is not a code. There is a way to just convert it to Python code, but for now you can just have it as u i. Now we do have also this edit right here. And this is for editing widgets and secondary sludge. We're not going to use it for now. There's a use of it that we can use it later on. We do have the widget view. You can see the widget box or just remove it, can remove the resources from here, so on and so forth. You do also have the preferences that you can choose, can change the template and so on. We do also have the window to minimize it or maximize it right here. Then you also have the help section here. Now what we're interested in is the widget boxes right here. So we do have the filter function or the option to search for any specific thing that we want. For example, we have vertical, we do have layouts, spacer, scroll bar and sliders. We also do have line. So this is a great way if you want something specific and you need it, by the way, you can just try it its name here. For example, checkbox. And then just click on it that and drop it here. And we're going to have you checkbox right here. Now, let's move on to another thing that is the object inspector, and this is this one. So basically this optic spectra idea is to provide a preview of all the objects on the current forum. So right now we don't have, we don't have anything. But for example, if I drag this right here, you're gonna see a few things. Let me just increase it a bit. And we're going to have a queue dialogue. Now let's move another thing we're going to have here, a spacer. We have the QV box layout that we just get. And whenever we add something is going to be right here, the object inspector. So we have the class right here and the object itself. And this is a great way to keep track of all of the current elements that we have in our pike R15 application. Now let's delete. These. Do have dQ dialogue, simple as that, because this is an empty screen where we created a queue dialogue on it. Now let's move on to another window that is the property editor. And this property editor is a window which is responsible for whatever appears in the QT designers main window. So for example, if we are at this window, we're going to get all of the elements right here. So let me just increase it a bit. Now, let's move, for example, there is an spacer. We're going to get it here. You have the orientation horizontal size type is expanding and size hint just faulty by 20. And this is for the spacer drag-and-drop and other thing right here, going to see the checkbox. And if I go back to this one, we're going to see the spacer. So it is the one that we are pointing to on the screen right here. So this will give us lot of information about the specific element and our bike 35 application. Now let's move on to a few other things. So for example, you will have the resources browser. And in this case, it is a quick way to add resources such as images, icons, FIS, or anything like that. We might need an hour Piketty, five applications. We can saw it right here and use it. Now, another thing is the action editor. And this provides a way to create actions. And if we have some forms that we need to add actions to, we can simply add the actions here and maybe use them in our forum again. So that's it basically for the windows that we have in pi or QT designer, we are going to use all of them basically and visualize or create a pocket of five applications with these widget box, object inspector, property editor, resource browser, and national editor. So that being said, this is the end of the introduction video about QT designer. See you in the next one. 30. Widget Box : All right, so in this video we're going to have a brief introduction about most of the features or most of the elements that we have right here and the widget box. We're not going to go through all of them, but most of them. So maybe it now next projects, we may use some widgets we haven't used. Yes, okay, because they all have the same idea and what they are for different users. Now what we're gonna do is to just create, let me just close this one. And again, we do have the dialogue with buttons, with buttons, right? And we do have without buttons, the main window and the width. Now the difference between the main window and the widget is that we remain when do we have an automatic toolbar that pops up right away? Widget when we don't have that. So if I create the main window, we're going to have this right-hand menu bar that is right here. Now what we can actually do here is to type. Let's suppose I need phi, phi press Enter. I'm allowed to have some menus or actions right here. Now if I press on this, maybe I want to choose Edit. I'm going to copy the QT designer from here. I'm not going to add all of these actions, but some of them. So if we have here edit, press Enter, we're going to have maybe just help at the end. So we do have these three. Now if I press on this, I can add some actions. So you have new and open and the same one. So if I press here and I type new, press enter, and then we have offered, which is also here. Now notice this small line that we have, the separator line. We can actually build it using the add separator. So if I press on it, we're going to have a line right here. Now, let me just continue. We do have save and save us. So I'm going to add Save, Save As, and then maybe add a separator, and then just quit. So that's it. This is our file passions. Now if we want to just do something for the edit, maybe we add cut and copy. So we're going to have cut and copy. Now let's go ahead and just view it. We can go ahead and preview it and deform. Go to this one. And we can see it here. We have our file and we have our edit right here. And let's close this and let's see what do we have also. Now if I press on this, I'm going to see our action inside this property editor. We do have the queue action that is for the new. We do have the text I can tax and tooltip of these reference to new file. Press on up and we're going to get them up and save, save as. And as you can see now in the object inspector, we're going to see all of the actions and menus that we created. So if we go ahead and have a look at it, we're going to see all of them right here. So if I maybe increase it, you're going to get action, action open separator action safe. I should save us all of the actions and menus that we just created. They're going to pop up here. And whenever we press on one of them, we're going to see the details of it inside this property editor. Now if you, for example, need a horizontal layout, I can just get it here. And this is our horizontal layout. For example, if I need a push button, I can get it and place it right here. Now if I need another push button, which is also horizontal, because we are adding it to a horizontal layout, we're going to get them in form of a horizontal manner. As long as I add, push buttons are going to be added in a horizontal way. Now if for example, let me just decrease the size of this. All right? So, all right, so this is our horizontal layout. I'm going to create now a vertical layout, which is this one. Fire at UQ push button. I'm going to get them and a horizontal way. Now let's go ahead and delete all of this. And now let's check, for example, the grid layout and add a few things to it. So let me increase the size of it. Going to add this. And as you can see, they going to be added in a form of grid. As long as I keep adding elements, they're going to be added like this. Now, let's move on to another element. For example, we have the radio button. So let me just delete all of this. And All right, so we have the radio button. Now, if I just take two radio buttons, if I click on the first one, let me preview it. If I click on this and this, they are automatically related to each other so we can't click on both of them during the same time. So if I click on this, this would be unclicked and so on and so forth. So this is for the radio buttons. Now notice if I press on this one, we're going to see it here. And the radio button, the second one that we just created is going to be of undisclosed to automatically, which is right here. And now let's move on to the checkboxes. For example. If I do have several checkboxes and I preview it, we're going to see it. And I can chat box multiple options at the same time. And we don't have any problem with that. So we do also also have a few buttons right here that you can check, but these are the main ones. Now let's move on to a few other things. So for example, we have the hair, the group box, we have the toolbox, and you do also have the combo box. So we just so in our basic widgets videos. So for example, if I need to use the combo box, if I press on this, we can add elements to it. So for example, let me just edit items, and here we can add few items. So the first item is going to be item one, item two. And finally item 3. Now if I press OK and OK, we're going to see it like this. So if I go ahead and preview it, we're gonna get item 1, item 2, and item 3, and we can choose between them. So this is it for the combo box. Let me see about this group box for bullet here, we can actually add a few things into it. And this is just a container that can work. We can add multiple elements into it under the same box name. Now, let me, let me just delete this and move on to a few other things. We do have the line edit that we've used earlier. We have detects edit just a bigger version of the light edit. We do also have the plain text, and we also have the spin box that we've used for simple additions and for integers. So for example, if we preview it here and incremented, we're gonna see 12345 and so on and so forth. We also have the time Edit. And this will allow us to do the same thing for time. This time instead of having integers. And let's move on to the scroll bars. Now we have the horizontal and vertical scroll bars. So let me just show you the horizontal one. And let me add the vertical one right here. Let's preview it. And as you can see, we can move right here with these scroll bars. And let's move on to the sliders. I will show you the simple slider, which is the vertical one. And let's preview it. We're going to see something like this. We already use all of these in our previous videos, but this is a simple way where we can drag and drop anything we want into our BY couldn't live application. Now, we do have some work to do. For example, if we want to do something with this slider, all this scroll bar right here. If the user just moves it or submit an application, we need to take the information from here. The texts or line edit or from D is date added and time added. So we're gonna take these information to whatever we want with them. Now, we do also have the display widgets where we have the labels, simple label. We have also the vertical and horizontal lines. These are simple lines to have whenever we want to separate few things between each other. We also have the tax browser. And this is a great way where we can add information. And let me just review it. As you can see. This is our text edit and this is our texts browser where we can't change the information. They use a can't change the information. Just AS the atmos of Deepak E5 applications. And this is a great way to just add information in the form of tax added that the user can't do. So that's it basically for this video, we took a look at the widget box. We do have the layout spaces, buttons. So Sean and we looked at them before we worked with them. And the previous videos where we created the basic widgets and added a few texts lines, nine adults. And we do work, we have worked with sliders, scroll bars, labels, and many more. But this is a great way to see it in a QT designer, which is this tool that allows us to create it with the drag and drop property. So now it is very easy for us to build it, but we need to create the functions behind this simple front and design. So that's it basically. Now in the next videos, we're going to start building small applications and put our pi 35 antiquity designers can send to use. So see you in the next videos. 31. Qt Designer First Application : Hello everyone. In this video we're going to talk about QT designer. We already had a simple introduction and we introduced what is QT designer, how to use it. And the windows that we have, all the features that we have this tool. Now what we're going to do is to actually create a simple application and then just use it in our PI could be five applications. So whenever we create a queue, the designer application who are going to get a UI file. And we need to just get this UEFI and loaded into our Python code. And to do that, we need to use some methods. And our pike cutie five applications inside a Python script right here. So what I'm going to do is to simply create a script. And I'm going to name it QT designer, first application. And of course the pie. So let me rename it and we're good to go. Now what we're gonna do is to upper QT designer and then start with building a window. So we're going to wait a bit and we're good. We're going to start with the main window that we have, going to click on it. And this is the main window that we discussed earlier. We have here this menu bar that we can change. So I'm going to maybe just file here. And nothing too fancy. I'm going to just take maybe a push button. We're gonna put it here and some label right here. And this label would say, this is the first by QT designer application. And now if you want to show all of it, you can simply just increase the size and good to go. Now this is the push button. If I need to rename it or just click, double-click on it and maybe just submit for example. We have nothing to submit, but it is a simple demo for now. Now what we're gonna do is to click, right-click here. We're going to see something layout. And this layout is actually what we discussed in our widget classes earlier. We have the layout horizontally and layout vertically. So if I click on layout horizontally, I'm going to get the windows are the labels and elements that I have here and my Pi codify application or this window labeled or just put in a horizontal way. Now if I control set and let me, and this is the vertical way. We got them in a vertical manner. We have this label and the bottom right here. Now what we're gonna do is to go back to a normal state. We just specified that we did this at this position. And we also do have this right here. Now as you can see, a phi semi just increase this. But now what we are going to do is to simply save this file into our directory where we have our code, the Python script that we're going to create. So I'm going to, I'm pressing Control Save to save this. And we're going to get this window going to head over to the desktop. And of course I'm going to write my directory. And inside this directory, I'm going to simply save this file as first UI. So maybe first Qt designer. And now if I click on Save, I'm going to have it in my directory right here. So if I check, just refresh and we're going to get it right here. We do have this file, first, designer dot u i. Now this QT designer UI file is actually an XML format. We can find it here. And it's just saving the data for us and a form of XML. Going to save it in classes named so on and so forth. You can go ahead and create it, but it is not practical to do that. If you want to write your code, you can simply do that in the Python script buffer. Now we do have our 2D design or UI right here, and we need to load it into our application. So to do that, we're going to import sys. And of course we're going to import from pipe, purify some few. We're going to import Q widgets and you IC. So we're going to use the UIC to load our UI from the XML file that we have. Now what we're going to do is to simply create the Q application. And we're going to have our g k. Sorry, let me just rewrite. It says that r d theta. And we got, We can start with a window. Now, this window is actually going to be the Q application that we just created earlier. And this application is the UI file that we have. So to do that we're going to simply write UIC and we're going to press and dot. We can just see some methods here. And we're going to use the Load UI method that we have right here. And I'm going to load the first QT designer file. So first QT designer wi. And we're good to go. We're going to simply show it and execute the app. So we get now, let us just open CMD and just run Python QT designer first application, the Pi. Running this result into this window that we just created. It is the same exact window that we have in our QT designer, as you can see. So let me just adjust this as you can see if you want to visualize it. You can click on View. I'm sorry. We're going to click on preview here. And we can see that they are exactly the same. Nothing is changing except that this is a preview, a good designer, and this is the actual application and the Python script that we just created. So this is the way, this is how we can create our QT designer application from the UI file that we can extract from this tool right here. So that being said, this is the end of this video. It was just an introductory video of how to use the UI files that we have inside our Python scripts. And of course in our projects we're going to use multiple files. We're going to have multiple UI files for different features, different functions, so on and so forth. We're going to merge all of them into one main code or my main Python script that will allow us to toggle between these and have whatever we want from them. So that's it basically for this video. See you in the next one. 32. Convert Ui To Python : All right, So welcome back. In this video, I'm going to show you how you can convert your UI file into a Python script. Now, you can do that if your code or your application is pretty simple, or if you have one window that you just need to extend the UI file and you don't really need to type the elements, such as the line added, text, labels, so on and so forth. You just need something simple to do the work. You can do that in QT designer. So we do have this main window from our previous video. We do have it in a simple way. Now what we can actually do is to save it. So we already said that in first until July. And as you can see, we do have tried here. So if we want to convert this into a Python script, we need to just run a simple command right here. And the command is to use Pi UIC five because we're using QT or panky D5. If you're using pica before, you're just going to change five into four. And it will work perfectly. And you're going to simply write the name of your UI file, in my case, is first QT designer dot UI. And you need to write 0 for the output file and dash o. And then you just going to write the name of the output file that you want. Now in my case, maybe I'll just name it the same pie QT, designer dot by instead of UI. Now if I hit run, we're going to get it converted. And as you can see, we do have a new file here. And you get into, this is first QT desire pipe, and it is just converted from this UI file. And as you can see, we got all our elements and we have so many things here going on. So for example, in this setup you, I do have, can clearly see that we have our central woods, we have the push button, we have the labeled, well, who do have the menu bar, menu file, status bar, all of these that we have in our window right here, so we can visualize them. And we do have bunch of other stuff such as the SA geometry is set object name, so on and so forth. And then we have the retranslate UI. And this is simple function that simply translates all of the UI elements into our actual buttons and labels that we just created inside this Python script. So we're going to extract everything from the main window. So for example, we have from when window, the bottom Submit then extracted and translate it into the text or the plain text. We use the Python script. So that's it basically for how to simply convert a UI file into a Python script. Now with that being said, this is the end of this video. See you in the next one. 33. Layout In Qt Designer : Hello and welcome back. In this video, we're going to go through the layouts that we have in the QT designer. So the first thing I'm gonna do is to simply create our maybe templates, going to choose one without buttons. And this is a very simple one that comes from nothing does an empty window. And now what we're going to introduce in this video is these layouts. So we have already used the horizontal and vertical. Now we're going to go through all of them and maybe use them in some examples to get use of them. And then just implement them in our next by QT five applications. All right, so let's start with creating a label. I'm going to drag and drop it here. And as we can see, we do have the label that we just got. And now what we're going to do is to simply change the text here. So we can either change the texts from this rise here, we can double-click on the element and we're going to just change it. Or we can go ahead and search in the property editor to text. And sorry, I'm going to press on it and just search text and we're going to see this text criteria, which indicates tax labor. Now if I double-click on it, I can change it. For example, I'm going to name this bottom one. And I want to change the color of it and its background color too. So to do that, I'm going to press on these three dots right here. We're going to get this to change the, maybe the characteristic of our element. I'm going to make it bold. Going to change, choose another color for such as yellow. And I'm going to maybe make it centered. And we're good. Let me just make it a bit bigger. And now press, Okay, and we're going to get it right here. This is Button 1. As we can see, we can't really see it because the background color isn't that good. Well, we can actually do is to head into the going to just type auto. And we're going to have autofill background. And you can click and check it. And then we're going to head into palette. And I'm going to just change the palette right here. I'm going to make it maybe let's make a blue and we're good to go. So this is Button 1. And as we can see, we changed both the characteristic of the element or of the text and its background. Now let's create another label. So I'm going to do the exact same thing, Button 2. And I'm going to change That's pellet into maybe red. And then going to enable the autofill background. And we're going to just click on text of it. So this is the text. And I'm going to simply adjusted. So I'm going to make it centered, bold and maybe and maybe white. All right, so this is our second button that we have. And what we're going to do now is to use the layout characteristic that we have an QT designer in order to maybe make it look a bit better. So we do have these two buttons. Now one way to deal with them or to just put them together is to lay them out horizontally or vertically right here. So let me just try it out. And I'm going to do is to simply lay out horizontally. And as we can see, we've got them in a horizontal manner. If I press on vertical, then I get them in a vertical manner. Now what we're going to also check is the delay out in a grid. And as you can see, it's not that the front of this vertical one. However, if we have multiple buttons, so if I have, for example, let me just delete this and we're good. So these are our two buttons. And what I'm going to do now is to simply just copy this. I'm going to name it button 3. And the final one is button for I'm sorry. I'm going to copy this. And I'm going to have it as four. All right, so now we do have all of them. If I just take them together and going to press on grid, going to see that they are in a form of grid. And phi want to have them just two-by-two table. We're going to have it like that. Now, let's suppose we have some labels for these buttons. They are not really buttons, they are actually labels that we just created. And I'm going to delete this and we're good to go. All right, so we do have all of our patterns and they are labeled labels actually, as we said, they are not q push button. But for the sake of the argument is suppose that we have these as buttons. And I'm going to do is to simply just like that. Going to take some labels. And we're going to just have them like that simple form. And now what we can actually do is to take all of these and maybe just used the layout in a form layout. And we're going to get it in that way. If I increase it a bit, we're going to just see it. All right, so this is how we can create these types of forms and maybe map the labels into the corresponding buttons in that way. Now, let's suppose that a window is pretty small in size. And we actually use all of the length right here of the height. And now what we can actually do is maybe we want to map another layout that is maybe similar to this one. So I do have these two labels. And I do have a suppose I have q push buttons. And I'm going to have these two push buttons right here. And let's assume that I saw them in this form layout. Now what you can actually do is to sort these now horizontally. So if I place this, we're going to get it in this way. Now, let's increase it a bit. And we're gonna get our form like that. So that's it. Basically this is the main idea of the layouts and how we can use them. And the final maybe remark here. So let's suppose that you do have a push button that you need to add. Maybe here you can just drag and drop it and you can see it right here. And let's suppose that you need to add it in the vertical way, right here, I'm sorry, in the horizontal way between these two forms, you can just go ahead, take it and place it right here. And you can see that it will take the space that is required of it. And that's it basically for the layout of the QT designer tool. That being said, this is the end of this video. See you in the next one. 34. Edit Tab Order : Hello and welcome back. In this video, we're gonna get introduced into the tab feature that we have in the QT designer tool. So the first thing I'm gonna do is to simply create a dialogue with buttons. And it comes with the OK and Cancel push buttons. So let me just make it a bit bigger. And what we're going to do is to track this and drop it here. Now what we're gonna do is to simply add a few things. So for example, I'm going to add labels. So I'm going to have labels. So this is labeled one, level two, level three, and labor for. So the first level will indicate, for example, the first name. So we're going to create a simple form, LastName. And then we do have, for example, email and phone number. And we got to go. Now what we're going to do is to simply create line adults for all of them. So we do have this 1, 2, 3, and 4. And I'm going to just drag all of them and place them in a form like that. So it's super easy to do and very practical to use in order to create a simple form like that. Now what we're gonna do is to simply add a new line edit here. So for example, let's suppose that we need a new information, the address. So I'm going to drag and drop it here. And I'm going to simply copy a label. And I'm going to simply add it into its corresponding place right here. And this is the address. Now what we're gonna do is to simply preview this. And we're going to find a simple problem that we are going to fix. Now as you can see, if the user is typing some information. So we have the FirstName, LastName. And now if I press Tab to move into the next one, I'm going to skip the address and go to the e-mail. So for example, First example.com, then the phone number. And if I press one more time on the tab, I'm going to just be sent to the address line Edit right here, where they can just simply place the address. And it is very annoying for users to have things like that because it is firstName, lastName, address, email, and phone number in this order. However, there are going through the first and last name then to the email, phone number and address. And this is because we added this address after creating the whole form and we have it like an addition to the original form that we have. So one way to deal with that is to use the Edit tab order. And if I press on it, we're going to get to 1, 2, 5, 3, and 4. So I'm going to simply change them like that. So less side again, we do have here 1, 2, 3, 4, and 5. Now we're good to go. We can simply close this and let's move on to the preview. And now if I present tab, you're going to see that we are going in the chronological order or the vertical order that we have inside our form. So this is simple maybe feature that we can use it as a very powerful one, especially if you're stuck in a form and you don't really know how to change this. Maybe instead of just deleting all of the form and doing it again, this will help you just do what you want with that form. So that's it basically for this video. See you in the next one. 35. Defining Buddies : Hi, So welcome back. In this video we're going to discuss how we can create bodies AND QT designer. So bodies are usually a connection between some widgets and they are normally between the queue label and another. Elements such as DQ line edits or a combo box. You tax credit, so on and so forth. And these connections are actually here to provide a quick keyboard shortcut. And this is when the user wants to move in a quick manner. Inside our form. They can use this keyboard shortcuts and they will help to out the way. So by setting bodies improve the usability of the directs that you have and improve the overall performance of your bakery five application. Now let's start with creating these bodies. And to do that, you need to simply right-click on each label and press and in the beginning. So we're going to add this right here. And what we're gonna do is to add this ampersand into all of the labels that we have. Some gonna add it here. And I'm gonna do the exact same thing for all of them. And finally, What we're gonna do is to simply connect these labels into the line ls that we have. So to do that, we need to simply just click on Edit bodies. Then click on this and just connected to its corresponding label. So you click and drop, right? So that's it. Basically this is how you can connect them. Now we do have a connection between all of these. And if I click on Save or just preview for now. And what we're gonna do now is to simply press on the first one, which is in the firstName. Now if we want to go to the email right here, we can notice that it starts with the letter E. So if we want to jump all the way from the first line at that to the fourth one. We can either use tap three times and we can get there, or we can simply press on the letter a because it starts with E. And as you can see, we do have simple line on the first letters of all of them. So if for example, I need to go to the letter P, I'm gonna do the exact same thing as before. So for example, if I am at the first one, I'm going to move to letter a as a way here. That's it. Basically this is how we can define buddies and just create a better buy purifiers application for the user. So that being said, this is the end of this video. See you in the next one. 36. Edit Slots & Signals: Hello and welcome back. In this video, we're going to talk about this right here, which is basically the edit signals and slots. So this will help us maybe just improve our pi 35 applications in terms of manipulating or adding a few functions into our buttons right here. So if we have this button and we need to submit the form for example, and we have first information here. We can just click on this, okay? And they should disappear from me. Or maybe we just pop up a message indicating that we received the form and the application was submitted successfully. Now, another example might be then we just delete all of this. And we're going to start over. What I'm going to do is to simply create two texts edits. So this is text edit one. I'm going to increase it a bit. I'm going to copy it, paste it here. Layout in a horizontal manner. And we're good to go. So that's it basically, let me just add a few buttons right here. So I'm going to add two buttons. So here we have push button. And this is for the first one. We're going to take another one for the second. Now what we're gonna do is to also these vertically, sorry, horizontally. And I think we are good to do a gunna, saw them like that. Now what we are going to do a sudo change this into image just adjusted. I'm going to change this into the maybe clear tax one. And then we do have the same thing here, clear texts to. Now what we're going to do is to simply go to the Edit settled sludge, going to edit this. So whenever oppress or click on this push button, we're going to clear the text editor right here. So what we're going to do is to simply press on, Okay, now we do have a relationship between these two. Whenever we click and the push button, we're going to clear this right here. And we're gonna do the exact same thing here. Whenever we click on the push button two, we're going to simply also clear everything that we have from here. Now, let's go back and review it. If I press or write anything right here. And I do have also a few things here. If I press in clear text one, I'm gonna see my text is appearing from the text at one. And if I present exit two, I'm gonna do are going to have the same exact result as before. So that's it. Basically we do have a couple more functions. So if you want to maybe click on this and you can see all of the functions that we have. And of course, if I press on this one, we're going to see the exact same thing we do have here, push button. Now if I press on this and maybe make it to the push button, we're going to see that we have tax added and the result is indicative queue push button. So that's it basically. Now what we can actually do is maybe try to connect these three together. So what I'm going to do now, simply assign this tax added into the push button that we have. I'm going to just use the text changed. And wherever the text change in the text edit, we're going to click the push button, right? So this is our relationship here. And of course what I'm going to do now is to maybe we make it for all of the elements. So I'm going to say that whenever we click and this push button, we're going to also click on push button two, and so on and so forth. Now, what we're going to say here is that whenever we click on the push button two, we're going to simply clear the message from the first one. So now let's preview it. And if I do have some may be taxed here and I write anything here, we should see this disappear. Because what we actually did is that we established three relationships between our four elements. So the first one is that whenever we write in the text and we detect that using detects changed function, we're going to clear this one or, I'm sorry, we're going to click on the push button. And if this is clicked, then this will also be clipped. And of course, the last relationship is that if this is clicked, we're going to clear the texts at that too. So that's it. Basically this is how you can use these functions. And there are built-in inside our edit texts slug criteria. So you do have multiple functions that you can use. And so powerful, most of them, we use them before, such as the text changed. We also used a few things from here we have the clicked set Jack, we have the show menu toggle, so on and so forth. So you can go ahead and start building some small applications using these functions that we have right here. So that's basically for this video. See you in the next one. 37. Dice Game Introduction: All right, So hello and welcome back. In this video we're going to introduce our project, that is the dice game. So as you can see, we do have two dice right here. And we do have also to Claire. So we have player one and player two. Each player has a score, and this is a final score. And they also do have the current score of the round. Now, let's start by using the roll button right here. So if the user presses on drones, so it starts with Player one, you can see that the current score and to whatever we have three plus three. And if we press is also one more time, we do have three plus 25 plus the all six. We're going to get 11 here. Now, each time the user had two options, is a role or hold. Now if he chooses hold, everything from here would be transferred into the score. So if I press and hold, we're going to see that we have 11 here. And this is place to turn now. So pledged to roll once, 4 plus 5, we do have nine. Now, the actual thing in this game is whoever gets one just loses their own. So if I continue on pressing here, can I see that we got 0 here? Because if I go to the concert and to visualize it, we can see that dice are 5 and 1. So player 2 got a die, one. And this is why it's a actually lost this route. So let me try again. We do have 11 Hold Then there to hold. So that's it. Basically the idea of this game. Whoever gets to 101st is the winner. So we do have 11 and 16. And place one has played, and he got right here one. And this is why nothing has changed. If I call again. And player two also got ones. And now we can enroll again. We have 34 for player two. So this is seven. Roll again, 2 and 4, 6 plus 7, 13. And if we want to hold, we can hold her. So that's it. Basically. This is it. And now what we actually did is that we shortened the when bone is or the wind score. I did it 25 just for the sake of the introductory video. But for the next videos we are going to use it as a 100. So that's it. Basically, this is the idea of this game. Whoever gets to a final score first, whens. And we do have the role and hold button. We also have the new game feature right here. And this is to create a new game whenever we want. So if I am in the middle of a game such as this one, we can see that if I press a new game, be reset to 0. So that's it basically for the dice game. The next couple of videos, we're going to start building the front end and then we're gonna move to the backend using the functions of each one. We do have new game, role and talk. And we also have some additional functions that we're going to discover. But with that being said, this is the end of this introductory video to see you in the next videos. 38. Dice Game: Building Application : So welcome back. In this video, we're going to start building our dice game we have previously seen. And we're going to start with importing these images. So I have the tie S1, 23, 456. So we're going to use these as random numbers as we discussed earlier, to show the users what dice number they got. And we're going to start building our application. Now, the first thing I'm going to do is to import, says, I'm going to import from pi 35, that QT widgets, everything. And we're going to import from Pi codify. I'm going to import the from QT GUI. Also everything and acids that we're going to import also from bike 35, the QT GUI that we have and cutie core for now. And then finally we're going to import from pica 35 or just limit, just add it, right, so we get, I'm pointing from Piketty fourth category, everything. And we're going to use them later. But for now, let's start with application. So I'm going to build the Q application as usual. And I'm going to build our queue widget. I'm going to set the window title. So set window title into dice game. And then we're going to set or fix the width into 1000. So that set. Now what we're gonna do is to also set style sheet of our window or widgets to be of background white for now, I believe it's always white, but we're going to add it. And what we're gonna do now is to create our first button, that is the new game button. And it will be in a box. And we're going to just set delay out of our widget to be the sparks. All right, so to do that, I'm going to create the new game button of type q push button to be new game. And then we're going to have, or we're going to set the cursor of this button to be pointing hand cursor. And this will help us out. I'll show you first the button without this. And then we're going to add it and see it action. So what I'm going to do is to simply let me create the box here. So box, it will be Q VBox layout. And then what we're gonna do is to simply add this widget into the box. Right? Now what we're gonna do is to simply set the layout of our widget to be disposed that we have right here. And then we're going to simply exit the system by executing the app. All right, so we're good. Now, if I go ahead and run this dice game, the pie, we're going to get, I like this, right? So we didn't show the window. Now, if I run it again, dice game dot, py. We're gonna get something like this. This is the new game button that we have. And it looks not so good at the moment. So we're going to improve the style of this pattern. Now what we're gonna do is to simply add a pointer to this cursor or a pointer to this button. So notice that whenever I come across this new game button, nothing will happen with my cursor. Now, to improve this, we're going to simply add a new game cursor. We're going to add cue cursor and to b of q t dot q t, and then that pointing and cursor. All right, so now we do have our cursor. Let me run this again. And we're going to see that whenever I move across this button, it will be a pointing hand cursor, not like the normal caution that we have. All right, So we improve this. Now, let's change the style or the CSS of this button. So let me go ahead and do it here. Now to CSS and Piketty five, what do you actually need to do is to simply use the set style sheet, just like the one we used here. So set style sheet and two, and then up and dependencies. Now inside this parentheses, I'm going to create our style sheet, and it will be of this type. Now I'm going to start with the position. So I'm going to make it absolute. And let me just start by saying that you don't really need to go into the CSS details. You just can copy this from here. And if you're not familiar with this, no problem, you can just go ahead and take this and place it in your set size sheet. Because at the end of the day this is a pipe purify, of course, not SCSS one, but it looks nicer to just have a good looking by 35 application. So if you're good, you can continue with me as long as you want. So width, we're going to have width of 200 pixels. You're going to have a 50 percent, right? And I'm going to have the color at this one. Looks nice. Now what we're gonna do is to simply just have the font family at the toe. And then we're going to have the font size to be 20 pixels. And I'm going to have to transform text into uppercase. And finally, I'm going to set the font-weight and to 300. All right, So now let me just run this again. And we do have some problems here, right? So I forgot to add this semicolon right here. And let me just run this again. And we're gonna get our button indicating that this is a new game. As we can see, we do have the button. It is a nice-looking button, but we can always remove the borders. So let me just add it here. So I'm going to have to set the border to none. Right? So I believe we're good for now. Alright, so that's it. Basically this is for the first button. One edition might be is to just increase the font size whenever we hover over this button. Now, to do that, we can actually do it in a pretty simple way. We're going to add here a hover. And we're going to increase the font size from 20 pixels to 30 pixels. And now let me just close this run. And we're gonna get the same exact thing as before. However, when I hover over this one, the font size will increase to 30 pixels and set of 20 pixels. Now, this is basically for the first button. I know that it took a long time to just with one button, but thermometer, we built the whole application with the box and so on. Now, in the next video, we're going to start by creating the players side and adding the dice into it. So that's it basically for this video. See you in the next one. 39. Dice Game: Adding Players: All right, So welcome back. In this video we're going to start building the player side. So let's start with building the labels of player one and player two. So I'm going to do that right here. And I'm going to have to come at here, building Player One and two labels. Here we just built the new game button. So I'm going to have to say, well, then the new game button. All right, so we're good. Now I said we're going to build pair one label and it will be of q labeled as usual. And it will say player one. And then we do have Player 2. Same thing to label and display Plato. All right. Now what we're gonna do is to simply add these into a sort of some sort of layout, that is a grid layout because we do have so many elements that we need to add. And we can't add them vertically or horizontally because we do need them in a form of table. So the first thing I'm gonna do is to simply create a grid will be a QC grid layout. And now inside this grid, I'm going to add Player 1 and Player 2. All right, so to do that, we're going to add a widget. And this widget will be if player one, and add another widget for Plato. Now if I go ahead and run this, let me just close this one and try this again. We can see that nothing has happened because we didn't really add this code into the layout. And we already have a layout for this winter, which is the box. All right, so to deal with that, what we can actually do is to simply create or add this grid into the bossa we have. So I'm gonna do that right here. So box that, add layout and we're going to add the code that we just created. All right, so now if I run this again, I'm going to see that we have the new game button and we do have player one and player two. Now notice that these are in a grid, however, they look vertically in this grid. We do have the pair one here and two here. Now what you can actually do about it is to simply add these in a horizontal manner. So the grid is actually just constructed in a default manner using the horizontal or vertical first. Now, what you can actually do is to add parameters to this grid. So we need Player one at index 0. So this is the row. And we do have, we needed at column zeros. All right, so player 2 would be at row 0 and column one for this. Now if I go ahead and run this again, I'm going to get something like that. And they're not truly centered. So what we can do about it is to simply centered them whenever we create these buttons. So we can do that by simply writing player one that set alignment. And we're going to use QT code for this. So cutie, go dot QT and then align center. Then we're gonna do the exact same thing for the second one. Cutie, cutie that align, right, align center. And we're good to go. Now let's close this run. And we're gonna see it player one and player two centered at the form of the credit that we have. All right, so that's it basically for Player 1 and Player 2. Now let's change the size using CSS. So what I'm going to do is to simply use the function that we have used earlier SAT style sheet into open it and we're going to start building it. All right, so the first thing I'm gonna do is to send, set the font size into 40 pixels. Then I'm going to simply use the text transform and to uppercase. And then we're going to have letter spacing between the letters. So we're going to have space of two pixels. I think it will be good. And then we're going to have to use margin top to just differentiate or add some margin between the players and the button or a new game. And I'm going to add 20 pixels for now. Then we have margin bottom. It will be 10 pixels. And the position will be relative. Right? I think we're good now. We just have the font-weight of a 100 for now. Now let's close run this again. And we're gonna get something like this. It looks a bit nicer than the one before. So we increase the size, font-weight, and the position of it. All right, So now we'll do the exact same thing for Plato. So I'm going to copy it, paste it, and just change this right here. All right, now disclose and visualize it one more time. And we got to go to, so we do have our players. This is the labors that we're going to use. Now what we're gonna do is to simply add the score of both players. So we do have score here and here. And we're gonna do the exact same thing as we did before. We're going to create a label and then assign a alignment center. And then we're going to change the style of it. So I'm going to name it score one. It will be of Q label and it will start with 0. And we do have score to also Q label and sought with CO2. All right, so I'm going to copy this and base or two times. This is four score one. And this is for score two. And now, if I go ahead and run this again, gonna get something like, I'm sorry, we didn't really add it to degrade. So let me go ahead and add it to the query criteria. Now remember that the first parameter is the actual element of widgets that we need to add. Then we do have two more parameters. The first one is for the row, I need it at true, do so at index one. And then we're going to add 0 here. And of course, if I need to add the score two, we're going to add it also at row 2, which is at index one. And the column should be at index 12. All right, so now let me close this and let's run again. And we're gonna get our labels for the score of player one and player two. Now let's adjust the style of them. So I'm gonna go ahead and do it really quick right here. Now after creating the boated discourse and setting the alignment, I'm going to add here score one, that set style sheet into. And we're going to start by building this time right here. So we're going to have the font size of just 80 pixels for now. Then we do have the font weight as before of a 100. And we're going to have the color. I'm going to use this color for now for D. So D, and think, looks nice. Then we do have the margin bottom of 130 pixels for now. All right, I think we're good to go. Let me just close this run again. Thus we can see we got our number which has 0 for now, for Player 1. Now let's adjust this to. So I'm going to copy score one and simply change it to Scott to close hand-drawn. And we're going to see that we got our buttons. Player One are paid to as labels and these scores too. All right, so that's it basically for building our two players by one or player two and the score. Now, in the next video, we're going to build the buttons to roll all the dice. We're going to add a few images and we're going to add the current score of both players. So that's it basically for this video. See you in the next one. 40. Dice Game: Score And Dices : All right, So welcome back. In this video, we're going to continue our 535 application or the dice game. Now what we're gonna do is to add some thought of box here and display the current score of the player. So let us start with this one I'm going to do is to simply add it here. I'm going to name it player one, current score. And it will be Q label. And I'm going to have it at 0 at first. Player to current score. And adults would be also a q labeled a value of 0, 2. All right. Now we do have our two labor status, add them into this. So I'm going to add the first widget, which is player one, current. And notice that everything related to player one is actually at column 0 right here. And everything related to player 2 is at column one. All right, so we're going to add it at index two of row and 0. And then we're going to also add for player two. And it will be at index 2 also, and the position of column 1. All right, so let's close this and run this again. And we're going to get this. Now notice that they are not at the center, so let me just improve it or modify it. So player one, current score alignment. And it will be a cutie core that UT alignment as usual, that align center. I'm going to copy this and just change here from player one to player two. And we get to go, let me just run it again. And we get, so we do have these here. And we're going to have a slightly different syntax or style for these. Because remember that these are the final or the original values and these are the current values paid in a single set in the game. So let's get into the style sheet of player one, current score. That set style sheet as usual. And we're going to start by opening the parentheses as usual and simply add in here. What we're going to do is to simply set the font size into 30 pixels. And then we're going to set the height into 20 pixels. The background color would be this one. The one that we've used for the label before. And the actual color will be FFF, right? And now what we're gonna do is to simply increase the width. And I'm going to set it to 40 percent. For now, the margin would be 0. And auto padding of 20 pixels for now and the text. All right, so we, we've set it before, so we don't really need it right here. Now, let me just close this and check it out. Run. And we're gonna get it right here. So as you can see, we got our player 1, the score, and the current score right here. Now we can do the exact same thing for Plato. So I'm going to just copy this and just changed, change here from plus one to plus two. And we get to go. Now let me close this run. And we're gonna get this as our 535 application for now. Now what we're gonna do is to add the dice here. So we're going to add two dice. The first one will be in this position, for example, and the other one would be right here. And we're going to add the buttons into this game. The buttons are the roll to roll the dice, and we do have the hold to just make the player hold whatever we have in the current. So we're going to transfer from here to here. So don't worry about these functions. We're going to do them later, but for now, we're going to just build the backend, I'm sorry, the front end of our dice game. All right, so let me just start with building the images. So we started by building deep layers scores, and we do have here the current scores. Now let's do it here. What I'm going to do is to simply add MHC1 and it will be Q picks map of the dice, 1 dot PNG. And then we do have Image 2. I'm going to take randomly queue picks, map. Dice to the PNG for now, we're going to change this later when the game begins. But for now we do have these two images. Now we're going to store them in a labeled. So we're going to have, maybe I'm going to name it image one label and it will be of Q label. And what we're gonna do is to simply add to it. So we're going to set picks map into image1 that we just got from here. And we're gonna do it the exact same thing for MHC2. So image to label it will be Q label type and we're going to add to it. So image to label that set Beck's map into Image 2. All right, so we do have the two images. Now, we need to add them to the grid. And the most optimal position for these two dice is at the center right here. Now remember that we have the grid and we do have the column one, and this is it. And you do also have the second column right here. So what we're gonna do is to simply shift or move this to a third column and then add the devices into column 2. So to do that, what we are going to change here is everything related to the player2. And we're going to change the position of the column from two, from one to two. And that's it basically. Now, if I go ahead and run this again, we're going to see that we have nothing changed for now because we didn't really add anything in between. So now, if I go ahead and add the widgets right here. So we're going to add image one labor to the position of this one right here. So it is at row 0 and just column one. All right, so we're gonna do it here, 01 and the second one will be also a TRO, right? So MHC2 label it will be at row one this time and also Column 1. Now let's close this and run it again. And we're gonna see that we got our images right here. They're too big for the game, but we just got them in the middle of these two, Player 1 and Plato. All. So now let's improve or let's decrease the size of these images. And one way to do that is to use the scaled function that we have for the image. And if I use it here, for example, image1, that scale. And I'm going to stay, escape them into 80 by 84 now. And I'm gonna do the exact same thing as before for image 2. And now notice that even if I run this code, let me just run it again. Nothing will happen because we didn't really change the image size, because this method actually returns a new image that is scaled at 80. 80. Alright, so I'm going to also save it in MHC1, and I'm going to save this in image two. So now we assigned MLH1 and MSH2 to new images of scale 80 by 80, width and height. All right, so now let's close this again. Run. And we're gonna find out that our images are now smaller than before. And height and width of them as 80. Alright, so as before, let me just adjust this Q label. So I'm going to simply use the image labeled that. And I'm going to set alignment into cutie, cutie dot align center. And I'm gonna do the exact same thing for image 2. And we're good to go. Let me just close this run again. And that set, basically, this is the dice 1 and this is dice 2. Alright, so we can see that dice 1 and new game are pretty much close to each other. So we might need to just have some margin or space between them. And I'm gonna do that by simply changing the style sheet. So I'm going to use the set style sheet that we have used earlier. So let me go ahead and do it here. So we have image one and image two labor. What I'm going to do is to simply change the padding right here. So that set style sheet. And I'm going to change it into, Alright, so we're good to go. Now. We're going to change the padding into a 100 pixels for top and zeros for right, bottom, and left. Right. Now we're good to go. Now, if I go ahead and close this run again, we're going to see that we have a great, good amount of space between the new game and the data we have right here. All right, so that's it basically for the two dices and that being satisfied at the end of this video and the next one we're going to build the last elements. And they are the buttons for roll and hold. And we're going to be pretty much done with this front end of the dice game. We're going to continue building the backend and use it in our game. So that's it basically for this video. See you in the next one. 41. Dice Game: Hold And Roll Buttons: Hello and welcome back. In this video, we're going to continue building this dice game. So we do have two dice. The first die is the one right here, and the second is crazy now, but I was thinking is to add the buttons of rolling the dice and the holding button right here. So after the second die right here. All right, so what we're gonna do is to simply put this. I'm going to start by simply creating the roll dice. And it will be a queue push button of label row. And we do have the hold to push button and it will say Hold. Now, after building these dice, what we're gonna do is to also set the cursor into pointing hand cursor for both of them. So roll dice. And we're going to set cursor into Q, cursor and cutie. Cutie, that pointing and cursor. All right, so we're good to go now, let me just add this for the whole two. And of course we need to add this into the actual credit that we have. So let me go ahead and add them right here. So great, that add widget. I'm going to add the roles dice at position of row two and index of column one. And then we're going to add the same thing for the hole. We're going to add it at row three and column one. And I think we're good to go run. Now as we can see, we got the role and hold right here. And we're gonna change them into started. We have four new game right now. Now let's have a quick look and the grid that we just created. So if I just place it right here, we can see, all right. Now as we can see for Player 1, all of the elements that are for display are actually displayed at the column one. So column one is at index 0. So everything for player one is at index of column one at 0. So as you can see, we do have here 0, 0, and 0. And then everything related to player 2 is actually at column 2, at index column 2, which is here to two and also do right here. And as for the dice and the buttons, we do have them at the middle, which is index one for the column. And as you can see here, he, they are MHC1, MHC2, roll dice and hold all of them at column one. So that's it basically for the grid that we have for now. Now let's improve the style sheet of the Holt and just also the whole dice. So I'm gonna go ahead and copy everything from the new game style sheet. And I'm going to just paste it here. I'm going to change this into roll dice. And I'm going to do it again for also the hold one. Right, so we're good now let me just close this run again. And we can see that we do have now the two buttons, road and hold right here. So that's it basically for the front end of the game. As you can see, we do have both players. We have the current score, we have the actual dice. And of course, the final role and hold buttons where we're going to scroll for the using that, that's playing and hold whenever he chooses to. All right, so that's it basically for the front end, the next video is going to start building the backend of this game. And we're going to link it to the front end and create the actual game and play it. That's it basically. See you in the next video. 42. Dice Game: Roll The Dice Button: Hello and welcome back. In this video, we're going to start with back-end of our dice game. And then I start with simply creating the functions that we're going to use whenever we undo button. So let me just run this one time. And as we can see, we have the new game, roll and hold, and we need to create functions for each one of them. So what we're gonna do is to simply start with the roll one. I'm going to go ahead and simply create. And I'm going to do it right here. So we have the roll dice button. And whenever roll dice is clicked, we're going to connect it to a function that is the, maybe just roll the dice. And I think we're good. Now what we're going to do is to start with using the function right here. So I'm going to create a function, and this will be roll the dice. And we're going to start with changing the parameters or the score that we have here and here according to the role that we have. Now, let's just take a moment and think about it. So whenever the user roles this dice, we're going to change the images of the dice. And we're going to get random images from one to six. Showed them here and add them to whatever we have in the current right here. All right, so to do that, what we're going to need is to simply store these scores of each player. So I'm going to create two arrays or two lists. The first one will be the player's score. And to be zeros, going to explain it in a minute and do that. Second one will be the player's current score. And it will be also instantiate it to 0. Now, I'm going to add an index for the current player, and it will be the first player for now. Now, these actually represent the parameters of this code that we have right here. All right, so player's score represents the actual score of player one and player two. So the player one will take the index 0 and Plato will have index 1. And plays current score is actually this one. So Player one, this is 0, it's this one. Then player 2, it's this one. So let's go ahead and change them inside the labels that we have, right? So we do have Q labels for player one and player two. And we also have four score one is CO2. So I'm going to change this into current, I'm sorry, player's score at 0 and player's score at one. And we're going to continue all the way Till play. One current score. It wouldn't be player's current score as 0. And we do have players current score at one. And that's it basically now we have changed the values into actual values. Now, if we run this code, we are going to notice that we're going to have an error. And this is because would simply using, I'm sorry, we didn't let me just comment this out and run it again. And we're going to get this error because dQ label takes a string and we have assigned an integer instead of string. So to just deal with that, I'm going to add STR here. And we're going to do the exact same thing for this one right here. Now we're good to go. We have stored string inside the queue label and everything should work fine. All right, so we do have one more, which is roll the dice because we just created this function. I will comment it out. Now run. And we got, so that's it basically now everything is as before. However, we changed the values from maybe static into dynamic that changes over time by changing the values right here. And these lists. Now, let's start with the roll the dice function. Now what we're gonna do at first is two. Just create Die 1. And this will be a random, and we're going to just import random here. This is a Python library. Now random.random. And now we're going to have random number between 16 and I2 will be the same rent and between 16. Now what we're gonna do is to simply print this to just have an idea of these dice by so dice. And we're going to add die one and die two. And let's just visualize it. So I'm going to have the method collect and comment, right? And we're good to go. Let's click on it. And that's it. Now if I press on row, we're going to see that we do have random dice each time we press this button. And we're good to go. Now what we should do is to actually store these values inside whatever we have plus the original value that we have in the current. Alright? And this depends on the player. So for example, if player one is playing, we should add this into players one current score. And we gonna do the exact same thing for. Now, let's go back and start with this. So what we're gonna do is to simply check at first, if one of the dice is equal to one, then we'll simply going to break out of this function because whenever we have a dy equal to one, this means that the person or the user has lost this route. And we're not going to add anything into the final score. We're going to simply reset the current score of this player. So let's go ahead and do it. So FDI one is equal to 1 or di2 is also equal to one. What we're going to do is to simply set the players current score into 0. All right, now let me explain this in a bit. What we actually did here is that we called the players current score. And we do have in place current score, both the scores of player one and player two. So in this one right here, as we said, we do have Player 1, which is this one, and player two, which is this one. And we're going to set this to 0. So whatever current we have, whatever play we have from this current player, we're going to simply set it to 0. And what we're going to do then is to check if the current player is the player one. And how do we do that? We're going to check if current layer is equal to 0. This means that it is the player one. And we're going to set the current score button or the current score label and 200. So to do that, we're going to simply state set player1 current score, that setText. And we're going to set it to 0. And we're going to also change the player to player 2 because Player 1 has lost. So current player will be of index one here. Now, don't get confused with this because current player is equal to 0. This means that this is player 1. And currently equal to one means that this is player two because we start at index 0. Now if this is not the case, what we're gonna do is to set the player to current score into 0. And we're going to simply change the current player and 200 in this case. Now, notice that we have maybe just an error here because Kepler is not defined and we do have this problem report undefined variable. And this is the current player which is a global variable. And we need to define it if we want to change it or when to use it right here. So to use it, we can simply dry it global and write the name of the variable and we're good to go. Now as we can see, we solved the problem for whenever we have a die one, we're going to simply just set the current score of wherever player we have and 200, and then change it in the actual labor that we have in Piketty file. And now what we can do is to continue our code or our function if we have no dice equal to 0. All right, so now what we're gonna do is to simply change the pictures into the random dice that we have here. So we're going to change image one label, and we're going to set picks map into the new image. So we're going to use q picks map. And the image will be, we're going to start with dice dash. We're going to change the number. Whatever we have in die one. So we're going to write dice, dash. Then we're going to add SDR, die one. And then we're going to add that PNG. So that's it. Basically, we need to also scale it. So I'm going to go ahead and do it right here. So that scaled and we're good to go. Who can scale it into 80 by 80. And we're gonna do the exact same thing to image 2. So picks map and it will be cubics map. And we're going to have dice, dash plus STR, the i2. And we're going to add plus dot PNG. And that's scaled into 80.80. All right, so now we have changed the pictures. Let me go ahead and run this again. So whenever we roll the die, we can see that the images changing. However, we have no values right here. The current score or define the scope of declares. And we need to improve this or modify it. So now what we're gonna do is to check if the current player is player one. And how do we do that? We can simply ask ourselves, if counter is equal to 0. If this is the case, what we're going to do is to set the current score of player one into whatever we have inside this current score plus these die right here. All right, so let's do that. If player one is playing, then player one current score, that setText. And we're going to set it into the string of, you're going to have the player1 current score, which is actually a string. And we're going to just add to it these die one and die to. So remember that player 1 dot current score is a string. So if I extracted player wanted current Skoda get, I'm sorry, the text. So if I get this and I tried to add D1 and D2 to it, we're gonna get an error because we do, we can't just get this plus this. We need to either concatenate them as a string or we need to convert this into an integer. And to do that, I'm going to simply add anti-A. And we're good to go. So if I try to run this, we're going to run into another problem, which is we can't add an integer to detect here. So we need to convert all of these into a string. And now we're good to go after that. What we can actually do is to also add the die one and die to, into the less that we have. So remember that we are at player one. What we can actually do is to simply add two players current score at the current player that we have going to add to it, the di1, di2. So that's it basically now what we can actually do is to check if this is not the case, we're going to simply do the exact same thing to the second player. So setText, STR, and we're going to get blurred to current score, that text. And we're going to add to it, die one, die two. All right, so I think we're good to go for now. We just need to simply add this going to current. Or we can, because this is the same for both of these, but we can actually do is to add it right here. So instead of typing it two times, I'm going to just take it and use it right here by. So I think we're good to go image, just adjust this and, and that's it basically for the roll the dice. In the next video, we're going to try it out and start with the next function. So see you then. 43. Dice Game: Hold, New Game And Winner Buttons: All right, So welcome back. In this video, we're going to continue building the functions of our game. But for now, let's see what we have from this. Roll the dice. So whenever I press on role, we're going to see that it is changing. We can also see that we do have right here the actual number of these to press on it. Again, we can actually see in the command right here that we got a one and the roll dice function. So this is why we set everything into 0. Now, what we're gonna do is to create a function for the whole button. Because even if I reached 2003 and I want to hold, nothing will happen. Just keep rolling until I get the 0. And then the position changes from whatever players playing to the other one. Now, using the function of hold, we can simply change or user can simply choose that. They no longer need to roll. Just want to hold for now. And I'm going to name it hold score. And in this function, the first one is think I'm going to do is to simply have the global current layer. And we're going to start by simply changing the player score into whatever we have, a net plus the current score of the player. So player's score will be of the current player, which is equal to whatever we have declared. The player score plus the players current score. The CarPlay. So this means that if player one is playing, for example, and they want to hold, what we are going to do is to simply add to the pair score, which is this one at current player. So this is it. We're going to add to it whatever we have in it, plus the current score right here into it. And now what we're going to do is to simply set the players current score and 200. All right, so that's it. Basically, this is what we should do. Now, even if we run this, we're not gonna get anything because we didn't actually change the labels that we have in our screen. So we need to also change this. Remember that these are the list that we have right here. They went, they are here to help us in the functions and the addition, because the actual labels are of type string and we can really do much with them. So this is why we just create this. Now what we're gonna do is to simply check whatever user is playing. So if player or the current player is equal to 0, this means that this is player 1. We're going to simply set the player one current score into 0 because we no longer needed. And what we are going to do is to simply also set the score one, which is the global score right here, N2. So setText N2. And we're going to set it to whatever we have at the player's score, wherever we added here. So to be of type STR player's score at current player. And after that, after holding, we're going to simply change the deep layer of from what, from 0 to one. Now if this is not the case, this means that this is player two playing. So we're going to set tax of player 220. And the score of player two will be whatever we have in the player's score and the current player that's playing. And after that, we need to change the player from one into 0. Now make sure that you change the player at the last line of the if statement, because otherwise, we're going to use it here and we're going to get confused because this is core one. And if you change it to pair two, we're gonna get the score of player two and add to it. So make sure that this is the last line of your statements. All right, so that's it basically for the whole one. Now if we go ahead and run it, so let me just add it real quick right here. Laughter, roll dice, hold that clicked. Dot connect. And we're going to have hold score. Now let's close this r1. And we're going to see that whenever I press on hold, we're going to just take everything from here and place it here. Now if I run. Roll again. We can see that this is Player 2. However, we got a one here. So this is why Plato has never played. But if I press and hold, and then one more time we can see that this is player two playing now and hold. And we didn't get, all right, so we got an error because the score to the setText into player's score. And this is because we didn't actually add a string here. So now we'll get to go run again. And as we can see, we have 10 and so on and so forth. So that's it. Basically we do have now our main functions, that is the role and hold the dice. Now what we're gonna do is to actually add a function for this new game right here. So let me just add it here. Now, this function will be the main function where we're going to create the new game. So let's think about this for a second. And you gain would be to set everything into 0. So create new game. And this one will be to simply use the Current player and players current score and player's score. And we're going to use all of them, set them into Xerox. So currents player would be equal to 0. The players current score would be also equal to 0 and less score equal to 0 too. Now, notice that even if we run this, even if we set everything into 0, if I roll the dice and hold File, click on New Game, nothing will happen. And this is because we didn't actually changed the label that we have right here. So to do that, we're going to simply use it here. So player one, current score, we're going to set text into 0, then do the same thing to occur. And 0. After that, we're going to also set the score one to 0. And finally, score two would be also 0. All right, so I think we're good to go now, if I run this again and just roll one time, hold, and let's roll here hold. And as we can see, we do have 617 eight if I press a new game, right? So nothing will happen because we didn't really add this function right here. So let me add it really quick. You game that collect and connect to create new game. Sorry about that. Now run. Roll, hold, hold, hold. And if I press a new game, they will be reset into zeros. So that's it basically for the new game, roll and hold. Now we do also have another function and this is to check the winner. So let me just go ahead and write a tray quick right here. So check winner. And we're going to check the one to each time the user press, presses on hold. So we're going to take the current layer as global. And we're going to check if the player's score at current player is a greater than or equal to a 100. If this is the case, this means that the player has already won. And we're going to simply just check which pair has already won. So if this is player 1, we're going to set the text of Player 1 and 2, winner and set the text into one to two. Now, let's go ahead and run this. I'm sorry, here for a text to player two, going to check if this is player 1 and display two. Now let's go ahead and run this and we're going to find some problems that we need to debug. Alright, so at first we need to add the check winner to the whole function. As we said, we need to check each time the user holds. So if it exceeds 100, then we're going to simply change the 12. All right, so let me just run this again. And as we can see, if we have 17, we're going to get it here. Then we're going to roll again, layer to layer one and so on and so forth until reaching the Actual number of 100. Now, as you can see, we do have here, alright, so 82 plus 41 is actually greater than a 100. However, if I press and hold, nothing will happen. We do have a 123 here. Overplayed two is actually not the winner yet. And if I continue, and I also have here a 105. So if I press hold again and press, so again, we're going to see that we do have winner right here. Now this is because we checking the winner according to the actual score right here. We're not actually adding the cans code that we have a moment that we do have. We did have 81 plus something in the 40s. So we need to add 81 plus 40 and then check if it exceeds 100. So let me just go ahead and do it here. So it is player score at current player plus we're going to get players current score. Also current player. The total of these exceeds 100. This means that we are on the right track and this is the actual when a no, let me just run it again. And I'm going to check it real quick. This time. We have 29 and 17. And I'm going to have all right, so we're going to have here 83 and we also have 25. So the total between them absolutely is a greater than a 100. So now if I press and hold, we're going to see a 108. And this is the one. Now the second part that we have is that we finished this game and we want to create a new one. So if I press on this new game, we're going to set everything to 0. However, we can notice that player two is actually simply labored as well. So we're gonna go ahead and fix that in the create new game here. So I'm going to set player1, that setText and to player 1, player 2, that set S into layer two. All right, so that's it basically. Now if we go ahead and run this again, and if we continue building this. So I'm gonna maybe, I'm going to just decrease it for, for a bit here into 25, just for the sake of this example. So now whoever reaches 25 as the actual winner. So in 1912 plus 70 and hold, this is the winner. Now if I create new game, everything will be set into zeros and including the player one and player two labels. So that's it basically for this dice game. We have created the front end and back and do it. And I think it is a great way to use everything that we have learned so far from q labels, skew push buttons, and just use functions inside our pocket, 25 applications and use the select Connect. Use CSS right here, and get into the pike 35 details from picks map into set the alignment, so on and so forth. So that's it basically for this project. See you the next one. 44. Project : Hello and welcome back. In this project, we're going to apply what you have learned earlier and approved the dice game that we just created. Now recall that in our dice game, we do have two players that need to play. And they do have to be really noted two rows and hold, such as this example. Now, your task is to let the player decide if he wants to have one player against the computer or to tears against each other. Now, in the case of two players against each others, nothing will happen. This code will run as good as it is. And in the case of Declare versus computer, you need to improve this code. So your task is actually to create new functions for the randomization of a program. Now recall that you do have all of the functions that you need, such as the hold and draw. You just need to do them for the program side. So instead of having two players that can draw and hold, you're going to have one player to roll and hold. And then the computer will also randomly roll and hold one, the term comes. So that's it basically for this whole project. And I'll leave the door for your creativity in order to create the functions required. And that's it. Basically don't forget to drop this project in the project section so I can give you my feedback. And if you do have any questions, please don't hesitate to contact me and I'll make sure to reply. So that's it basically for the project section. I hope to see you soon in my next courses. Goodbye.