 Hey everyone, welcome back to some more Python programming tutorials We've been looking at the end-py screen module and recently we've been checking out form objects We've been modifying their size changing their position and now we'll actually get into some more forms of the form object You'll notice in the documentation. It shows a lot of really cool options for what you have here There are different standard form classes you can inherit and kind of subclass to make your own nifty thing So in this video, I'm going to be talking about action form and split form other ones like pop-up and Action form minimal and stuff like that are pretty pretty simple to understand obviously action form and split form are as well, but those are the ones that I want to show you and Kind of get get to some cool stuff with so let's get to it. We'll take it. We'll take a look at split form first It's pretty simple all it has is a horizontal line across the middle the method get halfway We'll tell you where it has been drawn So this might be useful if you kind of want to compartmentalize the forms or the information that your user is entering So I mean hates easy enough Since it's part of a form object everything that we've already done even all these changes We've made with the position and the number of lines and columns Those will work just fine if we just change the form to a split form So now if I run this code actually, I should have saved this as 07 and I'll save back to what we initially had as 06 Get back over to 07 and we're good to go Okay Now Python 07 will give us our split form and just like it said we've got a horizontal line across the middle here So cool now we can play with this just a little bit It tells us this variable draw line at this determines the position with a line should be drawn across the screen It doesn't have to be the middle It can be set by passing draw line at the constructor or it can be set automatically by the value Returned by the method get halfway so get halfway by default is a function that returns the y-coordinate of the bar across the middle of The form by default it is the middle But of course you can reset it to what's going to equal if you pass in the draw line at So those kind of go hand in hand Let's play with it. If I were to pass in draw line at as an argument to my constructor draw line at let's say I don't know how long is our we got ten lines So if we said eight I'll try and run this we're down at the bottom and we're kind of like going through our okay bar our okay button That's kind of cool. That's a cool. Look right We do the same thing like it down at seven and then all the options down at the bottom You can like add to those would be kind of nice What else is there I mean that's really I guess all I wanted to show you on there There is of course move line on resize. This is a kind of determined if The form is resized like if a form fills up the whole screen and then you resize your terminal N pi curse and by screen sorry does have support for that It will try and resize the form accordingly and the move line on resize will determine you can set it Whether or not it will resize along with the form which it should By default it looks like a it is set by It is set to false by default looks like though if you're interested in that one You can totally play with it. I don't think I'm going to because I never have the need to resize my terminal Okay, now I want to check out action form action form is super cool because it gives you a little bit more functionality with your form I'll get rid of my draw line at argument and We'll change this to an action form And you can see right away what the change is we got cancel as well as okay We got two options here now both of them at the moment do nothing They Kind of don't do anything with our program. They still exit the code exit the program But they have special functions So this action form class creates ok and cancel buttons selecting either exits the form The method on ok or on cancel is called when the form exits assuming one of those is selected So subclassing these kind of normally would override them or both which is what we will end up doing But by default they do nothing so on ok. It's interesting normally all the other functions are like lowercase letter capital letter or For after editing and blood for like on start but on ok and on cancel interesting that they're both underscored and lowercase letters So now you could see if we had forms on ok We'll take in the self keyword Right now that we'll have it do nothing, but we'll say Ok button pressed on cancel cancel button pressed now here's an interesting thing because Obviously these functions are being called because I mean that's what we just learned that we know that's happening, but we're not able to really see it if I tried to Like change a value as to one of these oh Notice yeah, I was playing this with with this before actually where I set a variable name to the Widgets that I added f name and L name refer to first name and last name and I set that up because I wanted to actually See if I could modify the values After I press the button it's because you can access any attributes and variables to a widget on the form by actually Using the dot selector and then getting to that so I can say f name dot value can equal ok button pressed But the thing is since this exits the form it wouldn't it wouldn't be able to see it even if I removed the What is it? Next form option, I think yeah right over at the in the after editing if I remove that Even if I try to do this Fight the ok button. Okay, cool. It does work for us. That's awesome Ok button is pressed Now if I cancel nothing's gonna really change But I had to use control C to break out of that like I said here and then we can say For the cancel button if we want L name Cancel button is pressed. Let's see this code Cancel cancel button pressed or okay. Okay, Brun is pressed So again control C to break out of that So, okay, that was kind of a two-fold lesson that I didn't really mean to do but it's awesome that it happened that way You can access specific attributes and properties of your widgets by having them be variables that are returned by the self-add function or The add function of your form object and then the on okay and on cancel functions that come with an action form You can override and have functionality depending on what button is pressed So sweet that's that's I mean there we go. That's what I wanted to show you guys Pretty simple split form and action form. We'll get into others very very soon I know there is one more that I want to look at hint hint, but I want to show you something else before that because I think this is a good time To show you notifying and message boxes and confirm and deek and unconfirm Popup boxes. So yeah, we'll get into that in the next tutorial and I hope you guys enjoyed it Thank you for watching. Maybe you liked the video. Maybe leave me a comment So I'm gonna show you a criticism if you're feeling generous subscribe, you know, I'd love that. Thanks guys. Adios