Zmiana szerokości przycisków, dodanie ostatniego przycisku

This commit is contained in:
Sara Kowalska 2020-05-20 22:29:22 +02:00
parent 25c68df0f4
commit 895d554dce
3 changed files with 18 additions and 11 deletions

View File

@ -5,7 +5,7 @@
<excludeFolder url="file://$MODULE_DIR$/Restaurant/Marta/venv" /> <excludeFolder url="file://$MODULE_DIR$/Restaurant/Marta/venv" />
<excludeFolder url="file://$MODULE_DIR$/venv" /> <excludeFolder url="file://$MODULE_DIR$/venv" />
</content> </content>
<orderEntry type="jdk" jdkName="Python 3.7 (projekt_sztuczna)" jdkType="Python SDK" /> <orderEntry type="jdk" jdkName="Python 3.7" jdkType="Python SDK" />
<orderEntry type="sourceFolder" forTests="false" /> <orderEntry type="sourceFolder" forTests="false" />
</component> </component>
<component name="TestRunnerService"> <component name="TestRunnerService">

View File

@ -1,4 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<project version="4"> <project version="4">
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.7 (projekt_sztuczna)" project-jdk-type="Python SDK" /> <component name="ProjectRootManager" version="2" project-jdk-name="Python 3.7" project-jdk-type="Python SDK" />
</project> </project>

View File

@ -582,8 +582,13 @@ def button(msg, x, y, w, h, ic, ac, action=None):
pygame.draw.rect(window, ic, (x, y, w, h)) pygame.draw.rect(window, ic, (x, y, w, h))
smallText = pygame.font.Font("freesansbold.ttf", 15) smallText = pygame.font.Font("freesansbold.ttf", 15)
textSurf, textRect = text_objects(msg, smallText) words = [msg.split(' ')]
textRect.center = ((x+(w/2)), (y+(h/2))) textSurf, textRect = text_objects(words[0][0], smallText)
textRect.center = ((x+(w/2)), (y+(h/4)))
window.blit(textSurf, textRect)
textSurf, textRect = text_objects(words[0][1], smallText)
textRect.center = ((x + (w / 2)), (y + (3*h / 4)))
window.blit(textSurf, textRect) window.blit(textSurf, textRect)
@ -599,9 +604,10 @@ def redrawWindow(surface):
surface.blit(image, (puddles[i][0] * sizeBetween + 1, puddles[i][1] * sizeBetween + 1)) surface.blit(image, (puddles[i][0] * sizeBetween + 1, puddles[i][1] * sizeBetween + 1))
drawGrid(width, rows, surface) drawGrid(width, rows, surface)
button("Rozpoznawanie talerzy", 0, width + 1, 198, 48, light_beige, white) button("Rozpoznawanie talerzy", 0, width + 1, 150, 48, light_beige, white)
button("Ciężkostrawność dań", 200, width + 1, 198, 48, light_beige, white) button("Ciężkostrawność dań", 150, width + 1, 150, 48, light_beige, white)
button("Rozpoznawanie banknotów", 400, width + 1, 198, 48, light_beige, white) button("Rozpoznawanie banknotów", 300, width + 1, 150, 48, light_beige, white)
button("Polecanie dań", 450, width + 1, 150, 48, light_beige, white)
pygame.display.update() pygame.display.update()
@ -690,7 +696,7 @@ def main():
pln_model = Sequential() pln_model = Sequential()
recognizeCash(pln_model) recognizeCash(pln_model)
#pln_model.load_weights('Kinga/model_payment.h5') pln_model.load_weights('Kinga/model_payment.h5')
width = 600 width = 600
rows = 15 rows = 15
@ -732,9 +738,10 @@ def main():
if event.type == pygame.QUIT: if event.type == pygame.QUIT:
pygame.quit() pygame.quit()
quit() quit()
button("Rozpoznawanie talerzy", 0, width + 1, 198, 48, light_beige, white, classify) button("Rozpoznawanie talerzy", 0, width + 1, 150, 48, light_beige, white, classify)
button("Ciężkostrawność dań", 200, width + 1, 198, 48, light_beige, white, evaluate) button("Ciężkostrawność dań", 150, width + 1, 150, 48, light_beige, white, evaluate)
button("Rozpoznawanie banknotów", 400, width + 1, 198, 48, light_beige, white, payment) button("Rozpoznawanie banknotów", 300, width + 1, 150, 48, light_beige, white, payment)
button("Polecanie dań", 450, width + 1, 150, 48, light_beige, white) #Natalia tu dopisz swoją funkcję :)
redrawWindow(window) redrawWindow(window)
pygame.quit() pygame.quit()