Документ взят из кэша поисковой машины. Адрес оригинального документа : http://kodomo.cmm.msu.su/trac/snake/changeset/176
Дата изменения: Unknown
Дата индексирования: Sun Apr 10 01:37:40 2016
Кодировка: UTF-8
Changeset 176:e967a9b10fce ? Python Battle

Changeset 176:e967a9b10fce


Ignore:
Timestamp:
12/26/10 06:55:47 (5 years ago)
Author:
Alex Martynov
Branch:
default
Children:
178:586633c26679, 179:d73d8cecc812
Message:

edited the way of presenting round end, fixes #20

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main.py

    r175 r176 љ
    159159љ
    160160    def end (self):љ
    161љ        """End the game and raise the window that tels about it."""љ
    љ161        """End the round and raise the label that tels about it."""љ
    162162        self.run_cancel()љ
    163163        self.step_id = self.game_length + 666љ
    164љ        root = tk.Tk()љ
    165љ        end_label = tk.Label(root, text="End")љ
    166љ        end_label.pack()љ
    167љ        root.mainloop()љ
    љ164        w = self.canvas.winfo_width()љ
    љ165        h = self.canvas.winfo_height()љ
    љ166        cw = w/float(self.engine.field.w)љ
    љ167        ch = h/float(self.engine.field.h)љ
    љ168        c = min(cw, ch)љ
    љ169        field_geometry = (self.engine.field.w*c,self.engine.field.h*c)љ
    љ170        offset = ((w - field_geometry[0])/2.0, (h - field_geometry[1])/2.0)љ
    љ171        self.canvas.create_text(offset[0]+ field_geometry[0]/2.0, offset[1]+field_geometry[1]/2.0, text="End of the round", fill="white", font="bold")љ
    168172        passљ
    169173љ
Note: See TracChangeset for help on using the changeset viewer.