def testDrawSudoku(): print("Testing drawSudokuBoard()...") print("Since this is graphics, this test is not interactive.") print("Inspect each of these results manually to verify them.") basic_graphics.run(getSudokuBoard0(), 10, drawFn=drawSudokuBoard) basic_graphics.run(getSudokuBoard1(), 10, drawFn=drawSudokuBoard) print("Done!")
def testDrawChessBoard(): print("Testing drawChessBoard()...") print("Since this is graphics, this test is not interactive.") print("Inspect each of these results manually to verify them.") basic_graphics.run(getStandardChessBoard(), (0, 112, 255), 20, drawFn=drawChessBoard, width=500, height=500) basic_graphics.run(getSolitaireChessBoard(), (255, 150, 0), 0, drawFn=drawChessBoard, width=150, height=150) basic_graphics.run(getSimplifiedChessBoard(), (10, 255, 0), 30, drawFn=drawChessBoard, width=300, height=260) print("Done!")
import basic_graphics # create_rectangle: # https://anzeljg.github.io/rin2/book2/2405/docs/tkinter/create_rectangle.html def draw(canvas, width, height): ##canvas.create_line(2, 150, width/2, height/2) ####### ##canvas.create_rectangle(100,100,150,150) ####### # most graphics functions allow you to use optional parameters # to change the appearance of the object. These are written with the code # paramName=paramValue # after the core parameters in the code # fill changes the internal color of the shape ##canvas.create_rectangle( 0, 0, 150, 150, fill="yellow") # width changes the size of the border ##canvas.create_rectangle(100, 50, 250, 100, fill="orange", width=5) # outline changes the color of the border ##canvas.create_rectangle( 50, 100, 150, 200, fill="green", outline="red", width=3) # width=0 removes the border entirely ##canvas.create_rectangle(125, 25, 175, 190, fill="purple", width=0) ####### basic_graphics.run(width=400, height=300)
text='by Aidan Freeman', fill='white', font=f'Arial {42} bold') playButton = canvas.create_rectangle(500, 350, 900, 450, fill='lime') playLabel = canvas.create_text(700, 400, text='PLAY Test!', fill='white', font=f'Arial {42} bold') playButton.pack() serverButton = canvas.create_rectangle(500, 500, 900, 600, fill='lime') serverLabel = canvas.create_text(700, 550, text='Server Browser (Coming Soon)', fill='white', font=f'Arial {20} bold') versionLabel = canvas.create_text(1290, 690, text='Client Version 0.0.6', fill='white', font=f'Arial {10} bold') #mouse Click events def onMousePress(mouseX, mouseY): pass #window size basic_graphics.run(width=1366, height=768)
def testDrawDashedLine(): print('Testing drawDashedLine()... (confirm visually)') print(' drawDashedLine: dashLength of 5, win size of 400x400...', end='') basic_graphics.run(5, width=400, height=400, drawFn=drawDashedLine) print(' drawDashedLine: dashLength of 20, win size of 800x200...', end='') basic_graphics.run(20, width=800, height=200, drawFn=drawDashedLine)
def testDrawFancyWheels(): print('Testing drawFancyWheels()... (confirm visually)') print(' drawFancyWheels: 1 row x 1 col, win size of 400x400...', end='') basic_graphics.run(1, 1, width=400, height=400, drawFn=drawFancyWheels) print(' drawFancyWheels: 4 rows x 6 cols, win size of 900x600...', end='') basic_graphics.run(4, 6, width=900, height=600, drawFn=drawFancyWheels)
def testDrawLetterTypePieChart(): print('Testing drawLetterTypePieChart()...') basic_graphics.run(drawFn=drawLetterTypePieCharts, width=800, height=800) print('Do a visual inspection to verify this passed!')