Skip to content

Commit aa8ca08

Browse files
authoredOct 1, 2017
Update screens.py
1 parent 7313c75 commit aa8ca08

File tree

1 file changed

+24
-37
lines changed

1 file changed

+24
-37
lines changed
 

‎screens.py

+24-37
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,15 @@ def __init__(self, i, text, func):
77
self.screen_func = func
88

99
class Screens(Window):
10+
def new_lesson(self, screenNum):
11+
screenNum -= 1
12+
self.new()
13+
self.cenLbl(self.s[screenNum].text)
14+
if screenNum > 1:
15+
prevBtn(self.s[screenNum-1].func)
16+
if nextScn < len(self.s)-1:
17+
nextBtn(self.s[screenNum+1].func)
18+
1019
def __init__(self, master=None):
1120
super(Screens, self).__init__(master)
1221
self.master = master
@@ -31,68 +40,48 @@ def s_init(self):
3140
self.cenBtn(s.text, s.screen_func)
3241

3342
def idle(self):
34-
self.new()
35-
self.cenLbl(self.s[0].text)
43+
self.new_lesson(1)
3644
self.multiLbl("Hello, and welcome to LearnPythonWithPython. Today we will be learning about how to set up the IDE called IDLE but ... come to think about it, you are viewing this application so you probably already have IDLE installed. See you later.")
37-
self.btnNext(self.syn)
3845

3946
def syn(self):
40-
self.new()
41-
self.cenLbl(self.s[1].text)
47+
self.new_lesson(2)
4248
self.multiLbl("Congratulations! You've completed lesson 1. This is lesson 2. To see the basic syntax, look at the source code for this application.")
43-
self.btnPrev(self.idle)
44-
self.btnNext(self.var)
4549

4650
def var(self):
47-
self.new()
48-
self.cenLbl(self.s[2].text)
51+
self.new_lesson(3)
4952
self.multiLbl("Just like literally every single coding language in the world (except for maybe like BASIC and Assembly) and for sure every C based coding language (hint hint: Python is a C-based language), there are variables. There are many different types of variables in Python. Some examples are booleans (coming from Boolean algebra), lambdas (from lambda calculus) and numbers (from litterally every single form of math). Unlike 6th grade math, 7th grade math, 8th grade math, 9th grade math (Algebra I), 10th grade math (Geometry), 11th grade math (Algebra II), 12th grade math(Trigonometry?), college math(Calculus, Linear algebra, etc, etc, etc, and etc.), and some high school and college science(physics), variables in coding can have names longer than 1 letter with subscript. The only downside is that it takes up memory, and it takes up soooo mmuch storage. Like entire bytes. Soooooooo much!!!")
50-
self.btnPrev(self.syn)
51-
self.btnNext(self.data_types)
5253

5354
def data_types(self):
54-
self.new()
55-
self.cenLbl(self.s[3].text)
55+
self.new_lesson(4)
5656
self.multiLbl("As I said last lesson, variables can be mmmmmmaaaaaannnnnnyyyyyy different types of things. A variable can be an str which is an str-ing of text surrounded by quotes (e.g. \"Hello, world!\"), an int which is an int-eger (e.g. 42), a float which is a float-ing point number (e.g. 3.14159265358979323846264338327950288419716939937510), a boolean which is a boolean value (which is either True or False. I think it's False. Wait nevermind it's true.), an array which stores an array of values surrounded in brackets where all the values are seperated by ,s (e.g. [\"Why?\", \"Are we stronger than the elements?\", \"What's yellow and dangerous?\", \"What do you get when you multiply six by seven?\", \"How many Vogons does it take to change a lightbulb?\", \"How many roads must a man walk down?\", 42, True, [\"Waaaait... an array inside an array?\", \"that's cray-cray\"], \"Is the array done yet?\", False,...] you get the idea.), a dictionary which is basically a dictionary for variables (e.g. ages = {\"Bob\": 100, \"Me\": 11}) and sooooo on and soooo forth")
57-
self.btnPrev(self.var)
58-
self.btnNext(self.hello_world)
5957

6058
def hello_world(self):
61-
self.new()
62-
self.cenLbl(self.s[4].text)
59+
self.new_lesson(5)
6360
self.multiLbl("Hello world programs are usually the first to be learned because they are so simple, but why do they make them so simple? Those programs could be made harder and more fun by just a little bit. First things first, you need to know what a hello world program looks like, so look in the console. Go on. I'm not going anywhere. You want to be able to do that? Well, that sucks for you. This lesson is not about hello world. It's about the base methods in Python. \"What's a method?\" I hear you typing in the comments. Well, I'm not telling you. And also I don't read the comments. So sucks for you.\nSo any ways, there are many base methods >:(don't even try asking):< such as print and input. Print prints text to the console. Input asks the user for input. That simple. Well not really. In print you have to put () after it because it's a *method* and inside those parentheses put what you want to say (HAS TO BE AN STR (can be a variable)), for example print(\"LearnPythonWithPython\") will print LearnPythonWithPython. Seriously. Try it. PRESS LE BUTTON!!!")
6461
self.cenBtn("print(\"LearnPythonWithPython\")", self.hello_world_code)
6562
self.cenLbl("It's time for CHALLENGE TIME: Try to make a hello world program by declaring a variable called string and print()ing it")
66-
self.btnPrev(self.data_types)
67-
self.btnNext(self.inp)
6863

6964
def inp(self):
70-
self.new()
71-
self.cenLbl(self.s[5].text)
65+
self.new_lesson(6)
7266
self.multiLbl("Hello, world! That last (mini) project was fun...ish. We want to make programs with UI! We want user input() ... i mean interface lol lmao rofl lellellellellelelelelelllelleleellelelelellelelel. so user \"interface\" as they call it is an interface where users interact. Hey! There's another possible name! User Interaction stuf! well anyways, let's get to the point. The input() method is a good starting point for UI. It allows the user to enter ... wait for it ... input()! Inside the parentheses thingies, you have to type in what ever you want the computer to ask you. For instance, press the button that has a line of code on it.")
7367
self.cenBtn("inp = input(\"Enter your input here: \")\nprint(inp)", self.inp_code)
7468
self.cenLbl("Now you try to figure out a practical purpose for the input() method. Enter it in the comments (that I tooooootally read)")
75-
self.btnPrev(self.hello_world)
76-
self.btnNext(self.if_statement)
7769

7870
def if_statement(self):
79-
self.new()
80-
self.cenLbl(self.s[6].text)
71+
self.new_lesson(7)
8172
self.multiLbl("If statements determine *if* a condition (e.g. 1>2 is False and \"hello\" == \"hello\" is True) is True, then it does the stuff indented after the colon(:). One example is")
82-
btnTxt = """if True:
83-
\tprint(\"Yay! It's True!\")
73+
btnTxt = """
74+
if True:
75+
\tprint("if True: \n\t\"is always evaluated\"")
8476
if False:
85-
\tprint(\":( It's False")
77+
\tprint("if False: \n\t\"is never evaluated\"")
8678
"""
8779
self.cenBtn(btnText, self.if_code)
88-
self.btnPrev(self.inp)
89-
self.btnNext(self.else_elif)
9080

9181
def else_elif(self):
92-
self.new()
82+
self.new_lesson(8)
9383
self.cenLbl(self.s[7].text)
94-
self.multiLbl("\"But ... what if you want to test if something you just tested is not True? Do you need another if statement with (whatever condition) == False?\" I hear you commenting in the comment section. Well, the answer is NO STUPID!!! THIS IS PROGRAMMING!!! AND THIS LESSON EXISTS!!! WHAT DID YOU THINK IT WOULD BE ABOUT??? The solution lies in else statements, which literally translate to ... else. You just type else: and then whatever the **** you want if it is false. \"But what if you want to have an if and else statement *inside* an else statement?\" The answer is THIS IS CODING YOU NOT SMART PERSON. And plus, it says it in the title. elif is short for else if which is short for else-erwise if this is true.")
95-
self.btnPrev(self.if_statement)
84+
self.multiLbl("\"But ... what if you want to test if something you just tested is not True? Do you need another if statement with (whatever condition) == False?\" I hear you commenting in the comment section. Well, the answer is NO STUPID!!! THIS IS PROGRAMMING!!! AND THIS LESSON EXISTS!!! LOOK AT THE TITLE!!! WHAT DID YOU THINK IT WOULD BE ABOUT??? The solution lies in else statements, which literally translate to ... you guessed it — else. You just type else: and then whatever the print(\"****\") you want if the condition you tested is false. \"But what if you want to have an if and else statement *inside* an else statement?\" The answer is THIS IS CODING YOU NOT SMART PERSON. And plus, it says it in the title. elif is short for else if which is short for else-erwise if this is true.")
9685

9786
def hello_world_code(self):
9887
print("LearnPythonWithPython")
@@ -103,8 +92,6 @@ def inp_code(self):
10392

10493
def if_code(self):
10594
if True:
106-
print("Yay! It's True!")
95+
print("if True: \n\t\"is always evaluated\"")
10796
if False:
108-
print(":( It's False.")
109-
110-
97+
print("if False: \n\t\"is never evaluated\"")

0 commit comments

Comments
 (0)
Failed to load comments.