mundopana.blogg.se

Simple minesweeper python code
Simple minesweeper python code





simple minesweeper python code

HighScoreView(self, 'High Scores', self._scores.listing())

simple minesweeper python code

Showinfo('You did not get on the high score table.') Name = askstring('New Record', 'What is your name?') Self._blink(self._reset_button, button, 'red')īutton = count and str(count) or ' ' If button.blink_handle is not None and times = 8:īutton = (to_bg, from_bg)īlinker = functools.partial(self._blink, button,īutton.blink_handle = self.after(250, blinker) Self._blink(button, button, 'red')ĭef _blink(self, button, from_bg, to_bg, times=8): Self._after_handle = self.after(1000, self._tick) Self._wondering = self._width * self._height Self._reset_id(column=0, row=1,Ĭolumnspan=self._width, sticky=tkinter.EW)īutton = tkinter.Button(self, width=2, height=1, Self._reset_button = tkinter.Button(self) Self._id(columnspan=self._width, sticky=tkinter.EW) Self._timer = tkinter.Label(textvariable=self._secs) Root.protocol('WM_DELETE_WINDOW', window.close)ĭef _init_(self, master, width, height, mines, scores): Window = cls(root, width, height, mines, scores) import tkinterįrom tkinter.simpledialog import askstring, DialogĬlass main(cls, width, height, mines, scores): If you want a more complete example of a minesweeper game to either borrow ideas from or adapt for your own needs, the following program implements much of the functionality you might want from a finished game. import tkinterĭef _init_(self, master, width, height):Ĭommand = functools.partial(self._push, x, y) If you are trying to build a grid for the game and want to display buttons in a GUI your users can interact with, you may want to start with the following code as a basic framework for the rest of the code you will be writing. If you could give me some assistance in what to do, or just some general comments on my code, I would really appreciate it thanks. My issue is that i am getting a list index out of range for the GridOutMine = 1

simple minesweeper python code

GRIDD = * grid_across for i in range(grid_up)] This is my code so far: from random import randint Hi so I am making a minesweeper game and I am a bit stuck with the grid generation part.







Simple minesweeper python code