|
6 | 6 |
|
7 | 7 | 00:01:41 Mike, welcome to talk Python me know. Thanks so much for having me again. Yeah, it's great to have you here. Maybe you can just remind people of the last time you are here. You wrote a really cool book called I think it was 'Python Interviews'. Is that do I have the title, correct? Yes, that's correct. Yeah. And that was back in Episode 156. Way back in 2018. like three years ago, I guess more than that. But it was a history book. So it was looking back, right. It's fine. It's still relevant. People can check that out. And I really love some of the stories that you told on there. I love. I think it was Alex Martelli. you interviewed him and talked about how Google Video and YouTube are sort of competing neck and neck. And that was sort of a Python versus C++ story. That's probably the one that stuck with me the most. Yeah, I really enjoyed that one, or that does some good stuff in the Brett cannon interview as well. Yeah, there's a great stuff all over. I'm just trying to think of the one that I remember years later, you know, yeah, yeah. So it's been a couple years since you've been on the show. What do you been up to? Well, since that book came out, I have been pretty prolific in my writing and continue to write more Python books. For example, I've written one on 'wxPython', and 'Report Lab'. I redid 'Python 101', which was my first book, and Report lab is about like working with PDFs, right. Yes, you can use it to create PDFs, edit, but that book also covers how to edit options, edit, how to read and get data out of an existing PDF as well. Yeah. You got a couple of 101 201 type books as well. Yeah, like Learning Python? Yep. Python. 101 is for beginners and 201 is kind of intermediate advanced. So if I was like, a sophomore might take that, yes. Cool. So what are you doing these days? Are you doing the independent thing with your authoring and creating? Are you doing consulting? What do you do? Oh, I still would do a full time job. I write Python code that tests an embedded C++ application with Python. Oh, nice. It's really neat. But I also you know, kind of as a hobby slash side job I write for myself, I write, I write these books. And I occasionally contribute to real Python as well. A lot of good stuff going over real Python, Dan, and crew keeps that content flowing over there for sure. Yep. Yeah, absolutely. So, we're gonna talk about building GUIs. Or GUIs as some people say them? I know I'm okay. Are you a GUI? Are you a GUI sort of person? I usually call it GUI. Yeah, me too. So we're gonna talk about those for Python, which I think is interesting, because there are a have been, there are decent options. But it's not a place where Python has traditionally received a ton of focus and energy on building a lot of these frameworks have to do with taking another framework. That's a nice cross platform framework and like making it friendly for Python, right? I'm thinking of like, yeah, cute, or even wxPython, right? Yeah, it's usually a C++ wrapper that pre existed Python, and then it got wrapped with bindings of some sort. Yeah, exactly. A lot of these, especially the ones that do native widgets. Those are really just wrappers over the operating system when doing API's, right, like WIN 32 or is it COCO on macOS, those kinds of things. Right. So it's like some thin layer than some adaption adapting thing for Python. Right? Yeah, I think there's only a handful that aren't wrapping.
|
8 | 8 |
|
9 |
| -00:05:00 something else like be Where's toga? I don't believe is wrapping the native. I'm trying to look at it as I guess it is wrapping in a way, but it's not wrapping a pre existing framework. Right? Right. It's probably super low level, like here is a literally create a window that has a button. And that's it like, not like cute or something cute. Yeah, I think toga is actually like, you know, trying to render the cocoa widgets or the win 32 widgets itself, you know, rather than calling like Q2 or wx. Yeah, there's some value to that there's some value to that. So I thought the place that we could start is maybe a survey of these different libraries that we could use. Sure. Right. And so let's start with Tinker 'tkinter', which is really the Python interface to TCL/TK, right. Yeah, so this one comes built in. Right. I'm here on the Python 396 documentation. And I guess this is the official way to create GUIs with Python, right. I mean, in the sense that it ships with it, it ships with it, however, on like Linux, that the system Python does not come with. Okay. So you still got and I believe, I believe Mac is the same way you have to install it separately for it's just on Python two. Yeah, that wouldn't surprise me. Well, you know, the system, Python and Mac is all sorts of outdated and yes was basically right, like 27. Who knows what, right. But yeah, but it's always surprises me when I go to import t Kenter. And it's like, oh, it's not there. Like what? Yeah, exactly. Tell us about this one. Like, what's the good side? When would use it? Or would you use it when wouldn't use it? I don't like it because it looks a little old fashioned. But mainly because it draws all its own widgets, just like some of the other GUI toolkits. So basically, when you create a T kinter GUI, you know what the tkinter because it doesn't look native. However, you can use a TK enter, the code can be written without classes, you could write it completely functionally, and still make your work. So you know, as a learning way to create a GUI, it might be a good first, you know, a good beginner our first GUI to create with. Yeah, absolutely. Yeah, I put up on the screenshot screen for us to see there's like this TKinter Hotel Management System, it definitely doesn't I didn't see the top bar. I couldn't tell you what OS that's from. But because it doesn't look like OS that I know, right? Although, there's another example. I'll put these in the show notes. There's a pretty nice one that's hosting some kind of like predates Jupyter or something like hotels matplotlib exploration and stuff. And that looks like a pretty solid app to me. Yeah. tkinter did add a sub module called TTK, which does look a lot more native across platforms. You can make it look nice actually, if you if you spend the time, but you're going to have trouble finding good examples online because a lot of them just use the old the old interface. Another one thing I do want to note about TKinter is it's themable. So if you want it to look new, you want to add themes to your, your GUI, your ticket is an option for that. Oh, interesting things. So for example, you could give it a macOS like theme that turns on in that platform and a Linux theme maybe mode and not dark mode. Yeah, I was thinking of dark modes light modes be giving them a certain you know, color things kind of like a win amp type of skin. Yeah. Oh, man. Remember that? How crazy those skins would get. They'd get like 3d with little holes cut in. And yeah, that stuff got that got a little drawers like an alien tongue would shoot out and that's where like the playlists don't do that people don't do that. Okay, so for the most part TK inter is built in ish least it's sort of somewhat officially part of Python, right? Yes, it is another one one that I think of a lot when I think a cross platform stuff is cute. PyQt |
| 9 | +00:05:00 something else like be Where's toga? I don't believe is wrapping the native. I'm trying to look at it as I guess it is wrapping in a way, but it's not wrapping a pre existing framework. Right? Right. It's probably super low level, like here is a literally create a window that has a button. And that's it like, not like cute or something cute. Yeah, I think toga is actually like, you know, trying to render the cocoa widgets or the win 32 widgets itself, you know, rather than calling like Q2 or wx. Yeah, there's some value to that there's some value to that. So I thought the place that we could start is maybe a survey of these different libraries that we could use. Sure. Right. And so let's start with Tinker 'tkinter', which is really the Python interface to TCL/TK, right. Yeah, so this one comes built in. Right. I'm here on the Python 396 documentation. And I guess this is the official way to create GUIs with Python, right. I mean, in the sense that it ships with it, it ships with it, however, on like Linux, that the system Python does not come with. Okay. So you still got and I believe, I believe Mac is the same way you have to install it separately for it's just on Python two. Yeah, that wouldn't surprise me. Well, you know, the system, Python and Mac is all sorts of outdated and yes was basically right, like 27. Who knows what, right. But yeah, but it's always surprises me when I go to import t Kenter. And it's like, oh, it's not there. Like what? Yeah, exactly. Tell us about this one. Like, what's the good side? When would use it? Or would you use it when wouldn't use it? I don't like it because it looks a little old fashioned. But mainly because it draws all its own widgets, just like some of the other GUI toolkits. So basically, when you create a T kinter GUI, you know what the tkinter because it doesn't look native. However, you can use a Tkinter, the code can be written without classes, you could write it completely functionally, and still make your work. So you know, as a learning way to create a GUI, it might be a good first, you know, a good beginner our first GUI to create with. Yeah, absolutely. Yeah, I put up on the screenshot screen for us to see there's like this TKinter Hotel Management System, it definitely doesn't I didn't see the top bar. I couldn't tell you what OS that's from. But because it doesn't look like OS that I know, right? Although, there's another example. I'll put these in the show notes. There's a pretty nice one that's hosting some kind of like predates Jupyter or something like hotels matplotlib exploration and stuff. And that looks like a pretty solid app to me. Yeah. tkinter did add a sub module called TTK, which does look a lot more native across platforms. You can make it look nice actually, if you if you spend the time, but you're going to have trouble finding good examples online because a lot of them just use the old the old interface. Another one thing I do want to note about TKinter is it's themable. So if you want it to look new, you want to add themes to your, your GUI, your ticket is an option for that. Oh, interesting things. So for example, you could give it a macOS like theme that turns on in that platform and a Linux theme maybe mode and not dark mode. Yeah, I was thinking of dark modes light modes be giving them a certain you know, color things kind of like a win amp type of skin. Yeah. Oh, man. Remember that? How crazy those skins would get. They'd get like 3d with little holes cut in. And yeah, that stuff got that got a little drawers like an alien tongue would shoot out and that's where like the playlists don't do that people don't do that. Okay, so for the most part TK inter is built in ish least it's sort of somewhat officially part of Python, right? Yes, it is another one one that I think of a lot when I think a cross platform stuff is cute. PyQt |
10 | 10 |
|
11 | 11 | 00:08:45 PyQt. There's been a lot of different versions of PyQt. They're like a lot of stuff in licensing so like right here on the homepage. It says licensing PyQt has dual license on all the platforms under GPL 3 and the riverbank commercial one. Unlike PyQt is not available under LGPL, which is I guess what you would need for like a commercial closed source app. And there's, there's another wrapper around Qt. That I think is lgpl. Like the there's a lot of stuff that's just like, Well, why is it so complicated? Yeah. PyQt is kind of confusing when it comes to its licensing structure. Yeah, she's crazy, because I've had this conversation multiple times. And it seems like it I don't know it either. It never resolves clearly in my mind, or it's just challenging. But that said, there's really nice apps built with Qt. So for example, like one of the database tools I use for working with MongoDB is Robo 3T. And if you look at Robo 3T this thing is glorious in terms of its sort of native look and feel like if you go to the robomongo.org scroll down for the screenshots. There's the three OSS, side by side and every one of them looks like it belongs on that platform, right? Yeah, you can get a little bit simpler with instead of using PyQ, you could use Qt
|
12 | 12 |
|
|
0 commit comments