10UMLClass390118180240Game
--
__init__(who_am_i)
start()
act_on_message_received()
send_xy(x, y)
--
sender
ballUMLClass45087030main
UMLClass810128110140Ball
--
move_to(x, y)
--
diameter
idUMLClass580438250160Canvas (a tkinter class)
--
create_oval(x1, y1, x2, y2, fill=color) : id
coords(x1, y1, x2, y2)
--
width
heightRelation4702980110lt=<-
m2=constructs
m1=calls start10;90;10;10Relation56013927050lt=<-
m1=1..*
m2=1
constructs250;20;10;20Relation29012912050lt=<-
m1=1
m2=1
constructs10;20;100;20Relation210309390180lt=<-
constructs
m1=1
m2=1370;160;10;10Relation82025980200lt=<-
m1=1
m2=1
m1pos=5,0
m2pos=15,0
10;180;40;10UMLNote330489250100Note..
bg=green
create_oval puts the Ball on the Canvas
coords(x1, y1, x2, y2): moves the BallUMLClass15038150280GUI
--
make_canvas() : Canvas
make_chooser()
start
send_xy
--
root
frame
canvas
entry_for_x
entry_for_y
send_button
UMLNote1049140350Note..
bg=green
make_canvas:
makes a Canvas
that will have a
filled circle on it.
make_chooser:
makes two Entry
boxes and a Button
by which the user
can send x and y
coordinates to the
other computer
running this same
program.
When either computer
receives a message
with an x and y,
it moves its filled
circle to that x and y.Relation29021912080lt=<-
m1=1
m2=1
send_xy calls
send_xy100;20;10;20UMLClass60010270100Receiver
--
Runs in the background.
When. it receives a message, it calls the
act_on_message
method of the Game object.Relation560806060lt=<-10;40;40;10UMLNote570259210150Note..
bg=green
send_xy. uses the sender to send
an x and y to the other computer.
act_on_message_received is
called when a message is received.
It then tells the Ball to move to
the x and y in the received message.Relation56017927080lt=<-
m1=1
m2=1
act_on_message_received
calls move_to(x, y)250;20;10;20