Skip to content

Commit 41bd024

Browse files
committed
fixed indentation and keyword error
1 parent 7dddc06 commit 41bd024

File tree

2 files changed

+26
-14
lines changed

2 files changed

+26
-14
lines changed

Chapter01/banana_survey.py

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,15 +31,24 @@
3131
name_inp = tk.Entry(root)
3232

3333
# Use Checkbutton to get a boolean
34-
eater_inp = tk.Checkbutton(root, text='Check this box if you eat bananas')
34+
eater_inp = tk.Checkbutton(
35+
root,
36+
text='Check this box if you eat bananas'
37+
)
3538

3639
# Spinboxes are good for number entry
37-
num_label = tk.Label(root, text='How many bananas do you eat per day?')
38-
num_inp = tk.Spinbox(root, from_=0, increment=1, value=3)
40+
num_label = tk.Label(
41+
root,
42+
text='How many bananas do you eat per day?'
43+
)
44+
num_inp = tk.Spinbox(root, from_=0, to=1000, increment=1)
3945

4046
# Listbox is good for choices
4147

42-
color_label = tk.Label(root, text='What is the best color for a banana?')
48+
color_label = tk.Label(
49+
root,
50+
text='What is the best color for a banana?'
51+
)
4352
color_inp = tk.Listbox(root, height=1) # Only show selected item
4453
# add choices
4554
color_choices = (

Chapter01/banana_survey_variables.py

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -54,12 +54,15 @@
5454
# Listboxes don't work well with variables,
5555
# However OptionMenu works great!
5656
color_var = tk.StringVar(value='Any')
57-
color_label = tk.Label(root, text='What is the best color for a banana?')
57+
color_label = tk.Label(
58+
root,
59+
text='What is the best color for a banana?'
60+
)
5861
color_choices = (
5962
'Any', 'Green', 'Green Yellow', 'Yellow', 'Brown Spotted', 'Black'
6063
)
6164
color_inp = tk.OptionMenu(
62-
root, color_var, *color_choices
65+
root, color_var, *color_choices
6366
)
6467

6568
plantain_label = tk.Label(root, text='Do you eat plantains?')
@@ -73,16 +76,16 @@
7376
# The radio buttons are connected by using the same variable
7477
# The value of the var will be set to the button's 'value' property value
7578
plantain_yes_inp = tk.Radiobutton(
76-
plantain_frame,
77-
text='Yes',
78-
value=True,
79-
variable=plantain_var
79+
plantain_frame,
80+
text='Yes',
81+
value=True,
82+
variable=plantain_var
8083
)
8184
plantain_no_inp = tk.Radiobutton(
82-
plantain_frame,
83-
text='Ewww, no!',
84-
value=False,
85-
variable=plantain_var
85+
plantain_frame,
86+
text='Ewww, no!',
87+
value=False,
88+
variable=plantain_var
8689
)
8790

8891
# The Text widget doesn't support variables, sadly

0 commit comments

Comments
 (0)