Skip to content

Commit a82b28f

Browse files
committed
added f strings
1 parent 1c6b168 commit a82b28f

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

examples/joystick.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -72,48 +72,48 @@ def main():
7272
for joystick in joysticks.values():
7373
jid = joystick.get_instance_id()
7474

75-
lines.append(indent("Joystick {jid}", indentation))
75+
lines.append(indent(f"Joystick {jid}", indentation))
7676
indentation += 1
7777

7878
# Get the name from the OS for the controller/joystick.
7979
name = joystick.get_name()
80-
lines.append(indent("Joystick name: {name}", indentation))
80+
lines.append(indent(f"Joystick name: {name}", indentation))
8181

8282
guid = joystick.get_guid()
83-
lines.append(indent("GUID: {guid}"))
83+
lines.append(indent(f"GUID: {guid}", indentation))
8484

8585
power_level = joystick.get_power_level()
86-
lines.append(indent("Joystick's power level: {power_level}", indentation))
86+
lines.append(indent(f"Joystick's power level: {power_level}", indentation))
8787

8888
# Usually axis run in pairs, up/down for one, and left/right for
8989
# the other. Triggers count as axes.
9090
axes = joystick.get_numaxes()
91-
lines.append(indent("Number of axes: {axes}", indentation))
91+
lines.append(indent(f"Number of axes: {axes}", indentation))
9292
indentation += 1
9393

9494
for i in range(axes):
9595
axis = joystick.get_axis(i)
96-
lines.append(indent("Axis {i} value: {axis:>6.3f}", indentation))
96+
lines.append(indent(f"Axis {i} value: {axis:>6.3f}", indentation))
9797
indentation -= 1
9898

9999
buttons = joystick.get_numbuttons()
100-
lines.append(indent("Number of buttons: {buttons}", indentation))
100+
lines.append(indent(f"Number of buttons: {buttons}", indentation))
101101
indentation += 1
102102

103103
for i in range(buttons):
104104
button = joystick.get_button(i)
105-
lines.append(indent("Button {i:>2} value: {button}", indentation))
105+
lines.append(indent(f"Button {i:>2} value: {button}", indentation))
106106
indentation -= 1
107107

108108
hats = joystick.get_numhats()
109-
lines.append(indent("Number of hats: {hats}", indentation))
109+
lines.append(indent(f"Number of hats: {hats}", indentation))
110110
indentation += 1
111111

112112
# Hat position. All or nothing for direction, not a float like
113113
# get_axis(). Position is a tuple of int values (x, y).
114114
for i in range(hats):
115115
hat = joystick.get_hat(i)
116-
lines.append(indent("Hat {i} value: {str(hat)}", indentation))
116+
lines.append(indent(f"Hat {i} value: {str(hat)}", indentation))
117117
indentation -= 2
118118

119119
# draw the accumulated text

0 commit comments

Comments
 (0)