Skip to content

Commit 59fa91d

Browse files
committed
Fixes per chapter revision
1 parent 3a44f73 commit 59fa91d

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

Chapter07/ABQ_Data_Entry/abq_data_entry/models.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -100,9 +100,8 @@ def set(self, key, value):
100100

101101
def save(self):
102102
"""Save the current settings to the file"""
103-
json_string = json.dumps(self.fields)
104103
with open(self.filepath, 'w') as fh:
105-
fh.write(json_string)
104+
json.dump(self.fields, fh)
106105

107106
def load(self):
108107
"""Load the settings from the file"""
@@ -113,7 +112,7 @@ def load(self):
113112

114113
# open the file and read in the raw values
115114
with open(self.filepath, 'r') as fh:
116-
raw_values = json.loads(fh.read())
115+
raw_values = json.load(fh)
117116

118117
# don't implicitly trust the raw values, but only get known keys
119118
for key in self.fields:

Chapter07/menu_demo.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@
3434
# Add the appearance menu #
3535
###########################
3636

37-
font_bold = tk.BooleanVar()
38-
font_size = tk.IntVar()
37+
font_bold = tk.BooleanVar(value=False)
38+
font_size = tk.IntVar(value=10)
3939

4040
def set_font(*args):
4141
size = font_size.get()
@@ -45,6 +45,8 @@ def set_font(*args):
4545

4646
font_bold.trace_add('write', set_font)
4747
font_size.trace_add('write', set_font)
48+
set_font()
49+
4850

4951
# Create appearance menu
5052
appearance_menu = tk.Menu(main_menu, tearoff=False)

0 commit comments

Comments
 (0)