first commit

This commit is contained in:
=
2024-02-07 14:24:48 +01:00
commit ff58b527de
7 changed files with 374 additions and 0 deletions

29
menuBar.py Normal file
View File

@@ -0,0 +1,29 @@
from tkinter import Menu
class MenuBar(Menu):
def __init__(self, root, aztecDiamond):
super().__init__(root)
self.aztecDiamond = aztecDiamond
root.config(menu=self)
self.growLock = False
self.add_command(label="Grow", command=self.growDiamond)
self.add_command(label="Color", command=self.toggleColor)
self.add_command(label="NoBlack", command=self.toggleBlack)
def growDiamond(self):
if ~self.growLock:
self.growLock = ~self.growLock
self.aztecDiamond.grow_and_draw()
self.aztecDiamond.update()
self.growLock = ~self.growLock
def toggleColor(self):
self.aztecDiamond.direction_colored = not self.aztecDiamond.direction_colored
self.aztecDiamond.place()
def toggleBlack(self):
self.aztecDiamond.black = not self.aztecDiamond.black
self.aztecDiamond.place()