Placeholder Image

字幕列表 影片播放

  • What's going on?

  • Everybody.

  • And welcome to Achebe tutorial Siri's If you don't what TV is, it's a cross platform, gooey development library.

  • The idea is that you can coat it in one place one time, and it just works everywhere on Windows Mac clinics as well as on Mobile with like Android nine West.

  • Uh, it's been about four years since I looked into caving.

  • Curious about the changes.

  • Curious if, like packaging and deploying toe Lennox, I'm sorry.

  • Not Lennox, um Android and IOS like on mobile.

  • Curious.

  • See how that works out now, after it's been some time, was pretty clunky before, so to get started.

  • Ah, head over to aqui v dot or GE Go to download and grab the downloaded instructions for whatever operating system you intend to program on.

  • This isn't for running it.

  • It's just simply where do you wanna develop your key app?

  • So I'm on Windows, so I'd go here, grab these things.

  • There's some stuff that's ah like you.

  • You could.

  • This is optional key examples, also optional.

  • But if you like TV, I would suggest coming back and grabbing the examples just so you can see how other people have done things and get ideas about how you might want to do cool things with your key.

  • Be app.

  • Also check out the A P I reference.

  • If you want to learn more of the A P.

  • I is huge.

  • There's a lot of stuff here.

  • Okay, so it just kind of glanced through that Get ideas again about things you might want to make with TV, if you like e t.

  • So with that, go ahead and install the things you want.

  • Positivity.

  • If you need to and then continue when you're ready to go, we're gonna start making our first TV app ever in the Siri's.

  • What I'd like to do is make a chat app with TV.

  • So the idea is you can taking from, or sockets tutorial.

  • We want to be able to create a chap that can work on her phone and our desktop and all that kind of stuff.

  • So we're gonna use Ky v for the U Y.

  • Aspect of that.

  • So let's go and get started.

  • So, to use Kiki, no surprise.

  • We're going to import TV without the Capital K from tv dot app.

  • We're going to import app Uh, This is just your base AP class, every app is gonna have it then from tv dot u i x not label.

  • We are going to import label.

  • This is just so we can add some text.

  • Then we're gonna take evey dot requiring this just so we can make sure that people are using the same version again.

  • This is just mostly for development purposes, so key to require 1.10 point one.

  • Pay attention to what Bernanke you installed.

  • So as soon as you install it, you'll see what the version was.

  • So mine is 1.10 point one.

  • Yours might be something different.

  • Also, when you do install keep, you could always do pip install ky V equals or double equals 1.10 point one.

  • If you need to get the exact same version of me because something's not working and you're not sure if it's you or if it's just the version, Okay, continuing S o p p require.

  • Done.

  • Now let's go ahead.

  • Epic app and epic act is going to inherit from AP.

  • Can't get away with that.

  • My peppy winters happy with that or not?

  • Looks like it is okay class app Our class epic app inheriting from AP.

  • What do we want to do?

  • We're going to run the build method.

  • And the build method is pretty much your initialization method, right?

  • It's your initialization method without being an initialization method, because a party has won.

  • But you'll see in a moment we have to supersede that anyways Pretty quickly.

  • Anyway, you're initialization method.

  • So we're gonna build, and all we're gonna do is return.

  • Uh, label.

  • Ah, hey there.

  • And I don't remember if this is the assuming text is the first parameter.

  • But just in case go ahead, Just past text equals Hey there.

  • And then your usual is equals Somebody know it.

  • Dunder, Dunder Magic Dunder is fascinating.

  • Anybody knows what the heck that is.

  • You know, man.

  • Okay, if name Eagle's main epic app Run, Don't forget your parentheses In both cases, otherwise not gonna work very well.

  • Okay, let's go ahead and save that and I'm gonna run that in another window.

  • I don't think it's gonna work out in sublime.

  • I contested in sublime.

  • Let's just try it real quick.

  • I just don't think it's gonna work.

  • Yeah, I don't see it here so I'm gonna go and exit that tools, cancel the build, and then what I'm gonna do is come over to TV tutorial here, open the command prompt and doop I dash 37 TV APD up.

  • I go ahead and run that if you get in, the heirs will be displayed here so you can hopefully google them or ask Ain't asking the comments anyway, here is our app.

  • Awesome.

  • One thing to note right out of the gate is you can resize it, and it just kind of just works.

  • And this kind of the point is it works on many different screens or on the phone.

  • If you were to rotate your phone, it'll fix itself and all that.

  • So cool.

  • All right, So cool, but not that cool.

  • So now we're gonna do is actually start building the first page of our app because it is very boring up to this point.

  • So we're going to say from key V D u I x dot grid layout.

  • We're going to end for grid layout and then we want to bring in text input.

  • So from ky v dot u ex dot text input.

  • We're going to import text input.

  • So try to make a chat app.

  • The first step to this chat, you know, server app.

  • Thing is, we need to input at least a user name for sure.

  • But also, in our case, we can customize the port Night pee.

  • So really, the first page of this app needs to be like, you know, I p port and user name.

  • You know, um, for all those things and probably like a button to connect, and then when it's connecting, then switch to the chat app page right, which will just contain the chat history and then a field for you to chat in.

  • Okay.

  • So, um, so we're gonna use the grid loud.

  • This just so we can organize the widgets and stuff, right?

  • And then text input so we can input some text and then label we already have that.

  • So text input text from the user label.

  • So we can just put some text on the screen, basically.

  • So the first thing we're gonna do is make a new class.

  • So rather than epic app, just simply returning the label, it's actually what we'd like it to do is return the connect page Now we need to define the connect page.

  • So, uh, class, connect, page and connect Paige is going to inherit from the grid layout and then one thing to keep in mind at first, while there's many layouts but also to further customized layouts.

  • So you can like in the case of a grid, it's obviously a grid surprise.

  • But you could make make certain cells of that grid a certain percentage with their height on.

  • And then also, you can add layouts inside of layouts.

  • So just keep that in mind that you have lots of options there.

  • Anyway, connect page Gridley out.

  • Awesome.

  • Uh, we're gonna define our innit, innit?

  • Method here, uh, and past self here.

  • Don't forget that.

  • And the first thing that we want to do is actually run the innit method of grid layout.

  • So we're going to say super, uh, in it, And, uh, self and quarters or cards.

  • One day I'm gonna get it, and then we need to add that cords here is Well, okay, so if you don't totally understand that that's okay.

  • We've actually really never covered the super in it, But basically, all you're you're saying is super So you're referring to grid lout.

  • Run the innit method.

  • Okay, um and why might we wanna do that?

  • Well, John, I'm so glad that you asked.

  • Let's just copy pasta.

  • Uh, we just run a test.

  • Stop groups.

  • I want to do that.

  • I want this one to be modified Test up.

  • I We'll just open that.

  • And let's say you had two classes yet.

  • Class one.

  • Um, in fact, uh, let's stewed find in it.

  • And then all we're gonna do is print, uh, one.

  • Okay, let's say he did that.

  • Uh, and then you just copy this.

  • Come down here, paste.

  • We're gonna call this too two.

  • And let's say to inherits from class one, Such a parent class, Right?

  • Uh, let's just say we made it to object.

  • You'd see here it just prints too, right?

  • Um, but sometimes you'd actually want the innit method of the inherited from class, otherwise known as the parent class.

  • Uh, you want that to run as well.

  • So the way that you would do that is accessing the super method.

  • Uh, and then we're gonna say super in it.

  • Um, self, you're not sell ISI super in it.

  • They're really, um, in boot.

  • Obviously.

  • Don't need to pass self here.

  • That's just understood.

  • Okay, so, um, now, that's how you're gonna run one and two.

  • So you run the initialization method of both classes, and that's what we're trying to achieve here.

  • Okay, so, uh, back to the regular world.

  • Um, cool.

  • So the connect page basically gonna have two columns because you're gonna have some texts on the left and then the field and put on the right.

  • So it'll be like, you know, I pee and then you enter the I P.

  • Port colon, right?

  • You enter the port user name colon, enter the user name that you want to use, right, So we need to call him.

  • So where is a self dot calls?

  • Equals two, and then we're gonna start adding some widget.

  • So self dot ad underscore widgets.

  • This widget will be a label widgets where the text equals I p colon.

  • Then what we're gonna say is, ah, self dot i p equals the text input, and then we'll pass multi line eagles false here, and then we're gonna say self dot ad widget self ad widget, self dot i p So really you could say this.

  • So imagine you've got two columns and then infinite rose.

  • So boom, you've got I p colon.

  • Just a label.

  • It just says I p colon, and then right next to it, it says basically got this text input, which it added there so you could just boom in, put some text.

  • So which it number one digit number two.

  • We have exceeded two columns.

  • We now are on road number two.

  • Easy.

  • So now we're gonna basically d'oh uh, the same thing again with port and for user names.

  • So I'm actually just going to copy this paste paste P port and then user name, and then we're gonna say here, port, user name.

  • Copy this pasta there.

  • Copy that, pasta.

  • That.

  • All right, That looks pretty beautiful.

  • You guys think.

  • Is it gonna run?

  • Hey, man, there's only one way to find out.

  • Let's, uh, do this.

  • Say that, Um, So let me run it.

  • And just for the record, I probably won't always have this on the screen.

  • If I say I'm running it, I'm just doing pi 37 key V apt up.

  • I If you're on Mac os, I believe to run it.

  • It's skeevy.

  • And then the file name just for the record.

  • Mmm.

  • Did I pass self pride past self to this?

  • I really wanted to keep doing that.

  • I don't want to do that either.

  • I'm so used to just head in control B.

  • Okay.

  • Re running it.

  • Okay.

  • I know Python is where?

  • Okay, so there's our app.

  • Okay, So just in case I zoomed through that too quickly, I did the exact same thing I tried to do.

  • Just like I used to.

  • Like, any time I in it, I just passed self because, like, you never you never actually run in it, right?

  • Except when you're doing the super, But you never actually intentionally run in it.

  • So literally Every time I do it, it's just, like, ingrained in me yourself anyway.

  • Cool.

  • So here's our app and again pretty nice that you can just kind of continue re sizing it, and it just works, right?

  • So yeah, pretty cool.

  • Uh, now what we wanna have is probably one more row and have, like, some sort of submit button where you click on that.

  • And then we got a handle for that.

  • So one we need buttons.

  • We need to start handling for events with all kinds of stuff that we gotta figure out.

  • And I'm gonna say that for the next video.

  • So, uh, quick shoutout to my recent channel.

  • Sponsors, members, awesome people.

  • Clark, Juma Khan.

  • A Drac a duck's in dis year.

  • Then you guys very much for your support.

  • You guys are amazing.

  • All right, everybody.

  • I will see you guys in the next video.

What's going on?

字幕與單字

單字即點即查 點擊單字可以查詢單字解釋

B1 中級

Kivy介紹--移動和桌面應用開發與Python相結合 (Kivy Intro - Mobile and Desktop App Dev w/ Python)

  • 1 0
    林宜悉 發佈於 2021 年 01 月 14 日
影片單字