Exemplo n.º 1
0
    def __init__(self, picture_Width=1639,picture_Height=1228,picture="london.jpg"):
        
        self.app = Application(Police,MrX,log_core=40,log_mrx=40,log_police=40)
        
        #self.num_of_players = len(police_Array) + 1
        self.police = self.app.polices
        #self.total_player = len(police_Array) + 1

        self.misterX = self.app.x
            
        self.visible_moves_mrX = (3,8,13,18)
        self.num_of_moves = 1

        self.color_array = ["red", "green", "blue", "cyan", "magenta","white", "black"]
        self.mrX_color = "yellow"

        """
        Initialisierung von Tk
        """        
        self.root = Tk()
        self.root.bind("<Return>",self.draw)

        """
        Will man ein kleineres Bild als das Originalbild verwenden, kann man die Angaben in folgenden Variablen
        mitgeben --> picture_Widht,picture_Height
        """
        self.scale(1200,700)

        
        """
        Laedt alle Stationen in den 'stations' Array
        #e.g. stations[1] bezieht sich auf Punkt 1 auf dem Spielbrett
        """
        self.stations = self.load_stations()

        """
            -----------------------
            Erstellen des Canvas
            -----------------------
        """

        self.myCanvas = Canvas(self.root, width=1200,height=700)
        #self.myCanvas.bind("<Button-1>",self.alert)
        self.myCanvas.pack()


        """
            -----------------------
            Laden des Bildes
            -----------------------
        """ 

        self.image = self.load_image(os.path.join(GUI_DIR,picture))
        photo = ImageTk.PhotoImage(self.image)
        self.myCanvas.image = photo


        """
        anchor option setzt 0 0 koordinate nach oben links (NW), so dass
        ganzes bild angezeigt wird
        """
        self.myCanvas.create_image(0,0,image=photo,anchor=NW)


        """
        #punkt 1      
        s = self.stations[7]
        #s.punkt = self.myCanvas.create_oval(s.x1,s.y1,s.x2,s.y2,fill="black")
        s.punkt = self.draw_circle(s)
        #self.stations[7].punkt = self.draw_circle(self.stations[7])
        """

        """
            -----------------------
            Zeichnen der Startpositionen
            -----------------------
        """ 
        
        if self.police:
            count = 0
            for p in self.police:
                color = count % (len(self.color_array)-1)
                
                s = self.stations[p.get_position()]
                s.punkt = self.draw_circle(s,self.color_array[color])

                count += 1

            s = self.stations[self.misterX.get_position()]
            
            s.punkt = self.draw_star(s,self.mrX_color)
         
        self.root.mainloop()
Exemplo n.º 2
0
#!/usr/bin/env python2.7
# -*- coding: utf-8 -*
"""Script for backwards compatibility."""

from __future__ import unicode_literals

import sys

from start import Application


if __name__ == '__main__':
    # start application
    application = Application()
    application.start(sys.argv[1:])