wxPython Programming Tutorial 7: Adding Static Text and Colors

sentdex · Beginner ·🛠️ AI Tools & Apps ·13y ago

Key Takeaways

Demonstrates how to add static text and colors in wxPython programming

Full Transcript

hello and welcome to your seventh WX Python tutorial in this tutorial we're going to be working on some customization of this window most notably in the panel and as always we want to do this with a bit of interaction with the user since that's what it's all about these days is user interaction and customized ability based on the user so if you don't recall where we left off was here that's their name and s if they enjoy and then it asks them what their favorite color is they click that and up pops in this window so now what we want to do is like this text box is in what is known as the panel and like this kind of area right here is our panel and so this text box is just within the panel so let's exit this window and what we're gonna do first is change this panel a little bit first let's move the panel down because generally just like we did with the buttons you want all your button information kind of grouped all your customizable stuff that's happening back to back I think you want that group so you can kind of find this stuff over time when you're coming back to change up your program or whatever it just helps to have it groups so we're gonna put the panel stuff actually down here now the other thing we'd like to do let's go ahead and make room for some text that we're going to put on so we're gonna change the position of this panel instead we're gonna put it at 3 and a hundred and then we're gonna change the size so let's do like more like 150 and 50 so it'll be kind of long and short and so now what we're gonna do you'll see it will bring it up in the program just a second if you can't visualize that so now let's put something else in our panel so let's call this awesome awesome text but we'll just do our text for short equals W X dot static text and within the parameters you're gonna have basically four and the first one we're going to say panel and then we'll do negative one for the ID then you'll have awesome text is what will have that text say and then you finally you have the position of it and so you don't want it to conflict with this text panel that we have so that's why we move this text panel down it's down a hundred pixels so we got plenty of space but this text will put this text where at three three so it'll be three pixels over and through pixels down so if we run this now you'll see that we have awesome text here but let's be honest with ourselves that text really isn't that awesome so let's apply some colors to that text so we'll come down here and the way you do this is you do aught X obviously then you're gonna set the foreground for grant oh my goodness can't type foreground color set for grant let's make sure we did that right yep and then we'll set that color to yellow then we'll do the same thing we'll set a background Oh text got set background color and we'll set that background color to black okay so we'll save that we'll run it and up pops this window and now you can see you okay the text is looking a little more awesome now I'll you graphic designers out there I'm sure you were like okay okay but can we put hex color codes in there yes you can so not only can you like spell out the colors you can put the hex codes in there so let's do kind of like a light blue we'll save that and we'll run it and just you just put the hex color code within the parenthesis so it's a string itself and now you see okay now our awesome text it's this light blue on top of black so yes you can do hex color codes as well so you have you know any color you could possibly want and put in there so that's really cool but I bet you guys want to take it a step further and let's make this text like truly custom text based on user input and what better way to color our text than to color the text the same color that the user chose so let's do that real quick so we'll call this really attack so for really awesome text that's gonna be W X dot static text same thing as before it's gonna go in the panel it's ideal just be negative one and then we'll call this customized awesome miss then we're gonna say it's location will be same three pixels over but just so we have plenty of space we'll do it 30 pixels down now what we want to do is we'll say really awesome text equals W X dot static or I'm sorry it's really awesome text dot set foreground color and within these parentheses you can put the users see we save this as fav color and fav color is just corresponding to a string so we can just literally take fav color and copy and paste that variable right on in there and then the same thing before let me just copy and paste this and so we'll do really awesome text and then we paste set background color we'll still have that be black so now when we run this okay you said Harrison yeah I enjoy it now I can pick any color we want so let's say we want green so now we can see okay the customized awesomeness is green but what if we want a different color let's choose up red now it's red text so now that we've added a little bit of color I think that especially nowadays you know in the old days just having like the most basic GUI was like oh but this GUI nowadays is pretty disgusting so we're gonna continue building on making the GUI just maybe a little bit more appealing to somebody so I hope you're looking forward to that as always thank you for watching and thank you for my subscriptions it really helps to see like the people that support me so thanks for subscribing and until next time

Original Description

Full Playlist Link: http://www.youtube.com/playlist?list=PLQVvvaa0QuDc4SQhfpm6XHO0l-1Ybtur2 Code for this tutorial can be found on Sentdex.com Sentdex.com Facebook.com/sentdex Twitter.com/sentdex How to make graphical windows for user-friendliness within python, using wxPython!
Watch on YouTube ↗ (saves to browser)
Sign in to unlock AI tutor explanation · ⚡30

Playlist

Uploads from sentdex · sentdex · 10 of 60

1 Matplotlib Python Tutorial Part 1: Basics and your first Graph!
Matplotlib Python Tutorial Part 1: Basics and your first Graph!
sentdex
2 Python Encryption Tutorial with PyCrypto
Python Encryption Tutorial with PyCrypto
sentdex
3 Python's Logging Function
Python's Logging Function
sentdex
4 wxPython Tutorials 1: Making Windows GUIs with Python : Installing + 1st window!
wxPython Tutorials 1: Making Windows GUIs with Python : Installing + 1st window!
sentdex
5 wxPython Tutorials 2: Making Windows GUIs with Python: Customizing Window Parameters
wxPython Tutorials 2: Making Windows GUIs with Python: Customizing Window Parameters
sentdex
6 wxPython Programming Tutorial 3: Menu Bar and Menu Button
wxPython Programming Tutorial 3: Menu Bar and Menu Button
sentdex
7 wxPython Programming Tutorial 4: Panels
wxPython Programming Tutorial 4: Panels
sentdex
8 wxPython Programming Tutorial 5: User Input Saved To Variables
wxPython Programming Tutorial 5: User Input Saved To Variables
sentdex
9 wxPython Programming Tutorial 6: Multiple Choice Input
wxPython Programming Tutorial 6: Multiple Choice Input
sentdex
wxPython Programming Tutorial 7: Adding Static Text and Colors
wxPython Programming Tutorial 7: Adding Static Text and Colors
sentdex
11 wxPython Programming Tutorial 8: Custom Button Images
wxPython Programming Tutorial 8: Custom Button Images
sentdex
12 wxPython Programming Tutorial 9: Tool Bar Items and Sub Menus!
wxPython Programming Tutorial 9: Tool Bar Items and Sub Menus!
sentdex
13 Basic PHP Tutorial 13: Multi-dimensional Array
Basic PHP Tutorial 13: Multi-dimensional Array
sentdex
14 Basic PHP Tutorial 15: Functions and Global Variables
Basic PHP Tutorial 15: Functions and Global Variables
sentdex
15 Basic PHP Tutorial 12: Associative Array
Basic PHP Tutorial 12: Associative Array
sentdex
16 Basic PHP Tutorial 14: Foreach loop
Basic PHP Tutorial 14: Foreach loop
sentdex
17 Basic PHP Tutorial 16: Include and Require
Basic PHP Tutorial 16: Include and Require
sentdex
18 Basic PHP Tutorial 7: Assignment, comparison and Logical operators
Basic PHP Tutorial 7: Assignment, comparison and Logical operators
sentdex
19 Basic PHP Tutorial 4: Variables and Comments
Basic PHP Tutorial 4: Variables and Comments
sentdex
20 Basic PHP Tutorial 11: Arrays part 1, basic array
Basic PHP Tutorial 11: Arrays part 1, basic array
sentdex
21 Basic PHP Tutorial 6: If else and else if conditionals cont'd
Basic PHP Tutorial 6: If else and else if conditionals cont'd
sentdex
22 Basic PHP Tutorial 1: Intro to PHP
Basic PHP Tutorial 1: Intro to PHP
sentdex
23 Basic PHP Tutorial 3: HTML with PHP
Basic PHP Tutorial 3: HTML with PHP
sentdex
24 Basic PHP Tutorial 9: While Loop
Basic PHP Tutorial 9: While Loop
sentdex
25 Basic PHP Tutorial 10: Switch Statement
Basic PHP Tutorial 10: Switch Statement
sentdex
26 Basic PHP Tutorial 2: Print and Echo
Basic PHP Tutorial 2: Print and Echo
sentdex
27 Basic PHP Tutorial 5: If else and else if conditional statements
Basic PHP Tutorial 5: If else and else if conditional statements
sentdex
28 Basic PHP Tutorial 8: Arithmatic Operators: Doing math with php
Basic PHP Tutorial 8: Arithmatic Operators: Doing math with php
sentdex
29 Basic PHP Tutorial 17: User Input Form Example / String Manipulation
Basic PHP Tutorial 17: User Input Form Example / String Manipulation
sentdex
30 Basic PHP Tutorial 18: HTML Entities and forms cont'd
Basic PHP Tutorial 18: HTML Entities and forms cont'd
sentdex
31 Basic PHP Tutorial 19: Finding words in strings
Basic PHP Tutorial 19: Finding words in strings
sentdex
32 Basic PHP Programming Tutorial 20: Saving to a File / writing and appending
Basic PHP Programming Tutorial 20: Saving to a File / writing and appending
sentdex
33 Basic PHP Programming Tutorial 22: Hashing part 2: salting
Basic PHP Programming Tutorial 22: Hashing part 2: salting
sentdex
34 Basic PHP Programming Tutorial 23: Variables in Strings and tokenizing
Basic PHP Programming Tutorial 23: Variables in Strings and tokenizing
sentdex
35 Basic PHP Programming Tutorial 21: MD5 Hashing For Security
Basic PHP Programming Tutorial 21: MD5 Hashing For Security
sentdex
36 Basic PHP Programming Tutorial 24: String similarity
Basic PHP Programming Tutorial 24: String similarity
sentdex
37 Basic PHP Programming Tutorial 25: Time and Time stamps
Basic PHP Programming Tutorial 25: Time and Time stamps
sentdex
38 Basic PHP Programming Tutorial 26: Die and Exit
Basic PHP Programming Tutorial 26: Die and Exit
sentdex
39 Basic PHP Programming Tutorial 27: MySQL Databases Part 1
Basic PHP Programming Tutorial 27: MySQL Databases Part 1
sentdex
40 Basic PHP Programming Tutorial 28: MySQL Database Part 2: Reading From Database
Basic PHP Programming Tutorial 28: MySQL Database Part 2: Reading From Database
sentdex
41 Basic PHP Programming Tutorial 29: MySQL Database Part 3: Inputting Data
Basic PHP Programming Tutorial 29: MySQL Database Part 3: Inputting Data
sentdex
42 Basic PHP Programming Tutorial 30: MySQL database in Use
Basic PHP Programming Tutorial 30: MySQL database in Use
sentdex
43 Django Tutorial Web Development with Python Part 1: Installing Django
Django Tutorial Web Development with Python Part 1: Installing Django
sentdex
44 Python Tutorial: File Deletion and Folder Deletion / directory deletion
Python Tutorial: File Deletion and Folder Deletion / directory deletion
sentdex
45 Python Tutorial: How to Rename Files and Move Files with Python
Python Tutorial: How to Rename Files and Move Files with Python
sentdex
46 3D Graphs in Matplotlib for Python: Basic 3D Line
3D Graphs in Matplotlib for Python: Basic 3D Line
sentdex
47 3D Plotting in Matplotlib for Python: 3D Scatter Plot
3D Plotting in Matplotlib for Python: 3D Scatter Plot
sentdex
48 3D Charts in Matplotlib for Python: Multiple datasets scatter plot
3D Charts in Matplotlib for Python: Multiple datasets scatter plot
sentdex
49 Sikuli Tutorial 1: Visually programming in python!
Sikuli Tutorial 1: Visually programming in python!
sentdex
50 Sikuli Tutorial 2: Program visually in python!
Sikuli Tutorial 2: Program visually in python!
sentdex
51 Sikuli Tutorial 3: Program visually in python!
Sikuli Tutorial 3: Program visually in python!
sentdex
52 3D Bar Charts in Python and Matplotlib
3D Bar Charts in Python and Matplotlib
sentdex
53 3D Plane wire frame Graph Chart in Python
3D Plane wire frame Graph Chart in Python
sentdex
54 Raspberry Pi Part 1 Introduction
Raspberry Pi Part 1 Introduction
sentdex
55 Raspberry Pi Part 8: First Download and Update! (Firmware)
Raspberry Pi Part 8: First Download and Update! (Firmware)
sentdex
56 Raspberry Pi Part 10: How to set up a Linux Web Server on your Pi
Raspberry Pi Part 10: How to set up a Linux Web Server on your Pi
sentdex
57 Raspberry Pi Part 11: Remote Desktop
Raspberry Pi Part 11: Remote Desktop
sentdex
58 Twitter Analysis: How to rank a user's influence
Twitter Analysis: How to rank a user's influence
sentdex
59 GPIO Tutorial for Pi Part 2 - Programming the GPIO
GPIO Tutorial for Pi Part 2 - Programming the GPIO
sentdex
60 GPIO Tutorial for Raspberry Pi Part 1 - Setting up
GPIO Tutorial for Raspberry Pi Part 1 - Setting up
sentdex

Related AI Lessons

Up next
I Asked ChatGPT to Apply to 500 Jobs (8 Interviews in 48 Hours)
Sabrina Ramonov 🍄
Watch →