![]() ![]() Tkinter.Button(window, text="Restart", command=restartGame).grid(row=0, column=0, columnspan=cols, sticky=tkinter.N+tkinter.W+tkinter.S+tkinter.E)ī = tkinter.Button(window, text=" ", width=2, command=lambda x=x,y=y: clickOn(x,y))ī.bind("", lambda e, x=x, y=y:onRightClick(x, y))ī.grid(row=x+1, column=y, sticky=tkinter.N+tkinter.W+tkinter.S+tkinter.E) #prevent spawning mine on top of each otherįield = int(field) + 1 ![]() M = ("Custom size", "Maximum mines for this dimension is: " + str(r*c) + "\nEnter amount of mines")Ĭt("sizes", "amount", str(min(5,len(customsizes))))įor x in range(0,min(5,len(customsizes))):Ĭt("sizes", "row"+str(x), str(customsizes))Ĭt("sizes", "cols"+str(x), str(customsizes))Ĭt("sizes", "mines"+str(x), str(customsizes))Īmountofsizes = config.getint("sizes", "amount")Ĭustomsizes.append((config.getint("sizes", "row"+str(x)), config.getint("sizes", "cols"+str(x)), config.getint("sizes", "mines"+str(x)))) M = ("Custom size", "Enter amount of mines") R = ("Custom size", "Enter amount of rows")Ĭ = ("Custom size", "Enter amount of columns") Menubar.add_command(label="exit", command=lambda: stroy()) ![]() Menubar.add_cascade(label="size", menu=menusize) Menusize.add_command(label=str(customsizes)+"x"+str(customsizes)+" with "+str(customsizes)+" mines", command=lambda customsizes=customsizes: setSize(customsizes, customsizes, customsizes)) Menusize.add_command(label="custom", command=setCustomSize) Menusize.add_command(label="medium (20x20 with 40 mines)", command=lambda: setSize(20, 20, 40)) Menusize.add_command(label="small (10x10 with 10 mines)", command=lambda: setSize(10, 10, 10)) Menusize = tkinter.Menu(window, tearoff=0) import tkinter, configparser, random, os, ssagebox, tkinter.simpledialogĬolors = I have overall been coding in Python for a while now, but decided to give my code for review to see whatever my coding skills can be improved. I decided to do it using only libraries which are included in standard installation on Windows. Out of boredom I decided to make simple minesweeper in python. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |