Skip to content

Commit 1dbaa7a

Browse files
committed
Merge pull request kivy#2746 from merriam/master
Convert print statements to print function
2 parents 4ce149d + 40e930b commit 1dbaa7a

File tree

1 file changed

+17
-16
lines changed

1 file changed

+17
-16
lines changed

examples/application/app_suite.py

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
Explore how applications start. Starts applications one after another, waiting for
66
each to be closed first.
77
'''
8-
8+
from __future__ import print_function
99
import sys
1010
import re
1111
from random import choice
@@ -19,7 +19,7 @@
1919
from kivy.uix.floatlayout import FloatLayout
2020
# Note that importing FloatLayout causes Kivy to execute, including
2121
# starting up the Logger and some other messages.
22-
print "** In main program, done with imports"
22+
print("** In main program, done with imports")
2323

2424
class TestBuildApp(App):
2525
""" Use build() function to return a widget. """
@@ -28,7 +28,7 @@ def build(self):
2828
Called after trying to load a .kv file.
2929
Returns a new Button as a root widget.
3030
"""
31-
print "** inside build()"
31+
print("** inside build()")
3232
return Button(text='hello from TestBuildApp')
3333

3434
class TestKVFileApp(App):
@@ -53,17 +53,17 @@ class TestKVStringApp(App):
5353
Kivy language string. """
5454
def build(self):
5555
""" Called by kivy run(). """
56-
print "** inside build()"
56+
print("** inside build()")
5757
widget = Builder.load_string("Button:\n text: 'hello from TestKVStringApp'")
58-
print "** widget built"
58+
print("** widget built")
5959
return widget
6060

6161
class TestPrebuiltApp(App):
6262
""" Use the Builder to create a top level widget at the beginning
6363
of the Python program, then use a dummy class for that widget.
6464
This costs a bit more in start-up time. """
6565
Builder.load_string("<Prebuilt>\n Button:\n text:'hello from TestPrebuiltApp'")
66-
print "** in TestPrebuiltApp, class initialization built <Prebuilt>"
66+
print("** in TestPrebuiltApp, class initialization built <Prebuilt>")
6767

6868
class Prebuilt(FloatLayout):
6969
""" Empty class to cause setting root to <Prebuilt> tag and
@@ -83,14 +83,14 @@ def print_class(class_name):
8383
regex = "^(class " + class_name + "\\b.*?)^\\S"
8484
match = re.search(regex, data, flags=re.MULTILINE|re.DOTALL)
8585
if match:
86-
print match.group(1)
86+
print(match.group(1))
8787

8888
# the __name__ idiom executes when run from command line but not from import.
8989
if __name__ == '__main__':
9090
dash = "-" * 40
9191

9292
arg = sys.argv[1][0].lower() if len(sys.argv) > 1 else "h"
93-
print dash
93+
print(dash)
9494

9595
if arg == 'r':
9696
arg = choice('bfds')
@@ -111,22 +111,23 @@ def print_class(class_name):
111111
print_class("TestPrebuiltApp")
112112
TestPrebuiltApp().run()
113113
else: # help
114-
print """
114+
print("""
115115
This demo runs different application windows based on a command line argument.
116116
117117
Try using one of these:
118118
b - Use build() method to return a widget
119119
d - Use a kv file from a different directory
120120
f - Use a kv file with the widget object
121-
s - Use a kiva language string to create the widget.
122-
p - Use prebuilt widget from a kivy string
121+
p - Use prebuilt widget inside a layout
122+
s - Use a kiva language string to create the widget
123123
r - pick one of the demos at random.
124124
125125
h - show this help message.
126126
127-
After closing the application window, this program will exit. While the run() method
128-
does return, kivy cannot run another application.
129-
"""
127+
After closing the application window, this program will exit.
128+
While the run() method does return, kivy cannot run another
129+
application window after one has been closed.
130+
""")
130131

131-
print dash
132-
print "This program is gratified to be of use."
132+
print(dash)
133+
print("This program is gratified to be of use.")

0 commit comments

Comments
 (0)