def about_us(): while True : screen.fill(BG_COLOR) screen.blit(ravindra_img,(50,150)) message_to_screen("RAVINDRA SAINI",BLUE,130,350,"small") message_to_screen("*****@*****.**",BLACK,140,370) screen.blit(shrey_img,(380,150)) message_to_screen("SHREY MAHESHWARI",BLUE,450,350,"small") message_to_screen("*****@*****.**",BLACK,450,370) screen.blit(krc_img,(700,150)) message_to_screen("Dr. KR CHOUDHARY",BLUE,770,350,"small") message_to_screen("www.krchoudhary.com",BLACK,770,370) message_to_screen("(Mentor)",BLACK,770,390) pygame.display.update() for event in pygame.event.get(): if event.type == pygame.QUIT: pygame.quit() quit() if event.type == pygame.KEYDOWN: if event.key == pygame.K_c: combine.fun()
def get_input(): global inputStr inputStr = "" while True: time_passed = clock.tick(30) screen.fill(BG_COLOR) message_to_screen("INPUT STRING::", GREEN, 100, 300, "medium") message_to_screen(inputStr + "|", BLACK, 550, 300, "medium") pygame.display.update() for event in pygame.event.get(): if event.type == pygame.QUIT: pygame.quit() quit() if event.type == pygame.KEYDOWN: if event.key == pygame.K_0: inputStr += "0" if event.key == pygame.K_1: inputStr += "1" if event.key == pygame.K_2: inputStr += "2" if event.key == pygame.K_3: inputStr += "3" if event.key == pygame.K_4: inputStr += "4" if event.key == pygame.K_5: inputStr += "5" if event.key == pygame.K_6: inputStr += "6" if event.key == pygame.K_7: inputStr += "7" if event.key == pygame.K_8: inputStr += "8" if event.key == pygame.K_9: inputStr += "9" if event.key == pygame.K_BACKSPACE: inputStr = inputStr[:-1] if event.key == pygame.K_RETURN: # combine.obj.input_string = inputStr # combine.temp_input_string = inputStr combine.obj.input_string = inputStr # print(combine.obj.input_string) combine.obj.set_input_string() combine.obj.next_active_arrow() # combine.obj.input_string ="10000000" # print(combine.obj.input_string) combine.fun() if event.key == pygame.K_BACKSPACE: inputStr = inputStr[:-1]
def get_input(): inputStr = "" while True : time_passed = clock.tick(30) screen.fill(BG_COLOR) message_to_screen("INPUT STRING::",GREEN,100,300,"medium") message_to_screen(inputStr +"|",BLACK,550,300,"medium") pygame.display.update() for event in pygame.event.get(): if event.type == pygame.QUIT: pygame.quit() quit() if event.type == pygame.KEYDOWN: # if 0<=event.key <=9: # inputStr += (chr(event.key)) if event.key == pygame.K_0: inputStr += "0" if event.key == pygame.K_1: inputStr += "1" if event.key == pygame.K_2: inputStr += "2" if event.key == pygame.K_3: inputStr += "3" if event.key == pygame.K_4: inputStr += "4" if event.key == pygame.K_5: inputStr += "5" if event.key == pygame.K_6: inputStr += "6" if event.key == pygame.K_7: inputStr += "7" if event.key == pygame.K_8: inputStr += "8" if event.key == pygame.K_9: inputStr += "9" if event.key == pygame.K_BACKSPACE: inputStr = inputStr[:-1] if event.key == pygame.K_RETURN: combine.obj.input_string = inputStr combine.fun()
def intro(): while True: screen.fill(BG_COLOR) message_to_screen( "This is a semester project of \"theory of computation course\"", BLUE, 450, 100, "small") message_to_screen( "It simulates visual of turing machine that ditect ", BLUE, 450, 125, "small") message_to_screen("whether a string is palindrome or not ", BLUE, 450, 150, "small") message_to_screen("Here input should be a binary string of 0 and 1", BLUE, 450, 180, "small") pygame.display.update() for event in pygame.event.get(): if event.type == pygame.QUIT: pygame.quit() quit() if event.type == pygame.KEYDOWN: if event.key == pygame.K_c: combine.fun()
buttony + (buttonheight / 2)) screen.blit(textSurf, textRect) def text_objects(text, color, size): if size == "small": textSurface = smallfont.render(text, True, color) if size == "medium": textSurface = medfont.render(text, True, color) if size == "large": textSurface = largefont.render(text, True, color) return textSurface, textSurface.get_rect() while True: screen.fill(BG_COLOR) button("Intro", 350, 100, 250, 40, LIGHT_GREEN, GREEN, "Intro") button("Palindrome Detection", 350, 180, 250, 40, LIGHT_GREEN, GREEN, "Palindrome") button("About us", 350, 260, 250, 40, LIGHT_GREEN, GREEN, "About us") pygame.display.update() for event in pygame.event.get(): if event.type == pygame.QUIT: pygame.quit() quit() if event.type == pygame.KEYDOWN: if event.key == pygame.K_c: combine.fun()