full circle magazine #65
6
H
H
O
O
W
W
-
-
T
T
O
O
Written by Greg D. Walters
P
P
r
r
o
o
g
g
r
r
a
a
m
m
m
m
i
i
n
n
g
g
i
i
n
n
P
P
y
y
t
t
h
h
o
o
n
n
-
-
P
P
a
a
r
r
t
t
3
3
7
7
T
his month, we’ll finish up
the transposer program
that we wrote in Kivy.
Hopefully, you saved the
code from last time, because we’ll
be building upon it. If not, grab the
code from FCM#64.
Let’s start by recapping what
we did last month. We created an
application that allows for a
guitarist to quickly transpose from
one key to the other. The ultimate
goal is to be able to run this app
not only on your Linux or Windows
box, but on an android device as
well. I take mine on my tablet
whenever I go to band practice. I
was going to deal with packaging
our project for Android, but some
things have changed in the method
to do that, so we’ll work on that
next month.
The app, as we left it last time,
looked like that shown below left.
When we are done, it should
look like the screen below right.
The first thing you will notice is
that there are blue labels rather
than boring gray ones. The next is
that there are three buttons.
Finally the scrollable labels are
closer to the entire width of the
window. Other than that, it’s
pretty much (visually) the same.
One of the buttons is an “about”
button that will pop up simple
information, but it explains how to
make a simple popup. One of the
buttons is an exit button. The
other button will swap the label
text to make it easy to transpose
from piano to guitar or guitar to
piano.
Let’s get started by creating a
.kv file (above right). This is what
will give us the colored labels. It’s a
very simple file.
#:kivy 1.0
#:import kivy kivy
<BoundedLabel>:
canvas.before:
Color:
rgb: 0, 0, 1
Rectangle:
pos: self.pos
size: self.size