tayaent.blogg.se

Mplay pygame
Mplay pygame








mplay pygame

Status_field = Entry(root, font=( "arial", 15, "bold")) Person2_field = Entry(root, font=( "arial", 15, "bold"))

mplay pygame

Person1_field = Entry(root, font=( "arial", 15, "bold")) Set the parent window you want to place the widgets in and the font styles it should have. id(row= 1, column= 0)ĭefine three entry widgets to get the values of the two persons and display their status. Place the first label in the second row, the second label in the third row, and the third label in the fourth row. Use the grid manager to arrange the three widgets in the first column. Add some padding in the horizontal direction. Set the parent window you want to place them in, the text it should display, the font color, the background color, and the font styles. root = Tk()ĭefine three labels to denote the two persons and their relationship status. Set the background color of your choice, the size, and the title of your application. Initialize the Tkinter instance and display the root window by passing it to the class. Use the focus_set() method on the first entry field to activate and indicate the user to enter values in it. Use the delete() function from the first index to the last on the three entry fields to clear out the contents displayed on the screen. while len(result) > 1:ĭefine a function, clear_all().

mplay pygame

Insert the result into the status field at the first character position to display the relationship status. This ensures you can count in an anticlockwise direction. If the index is greater than or equals zero, slice the lists into two parts and store the concatenated string with the right part added first in order. Until the letters in the result list are not zero, store the index value from where you have to perform the slicing. Ret_list = remove_match_char(p1_list, p2_list) Find the index of the asterisk you inserted and slice the strings into two lists before and after it.Ĭount the number of characters in the two lists and define a list that stores the various status a relationship can have as per the FLAMES game. Store the concatenated list and the flag status received from the function. Until the value of proceed is true, call the remove_match_char() function and pass the two lists you just created. Repeat this with the name of the second person and set the proceed variable to True. Convert the name into a list of characters. Convert all the letters to lowercase and eliminate any spaces in between. Retrieve the name of the person the user entered using the get() method on the Entry widget. from tkinter import *ĭefine a function, tell_status(). In case no letters match, return the list as created above. Return the third list along with the match found as True. Check if there’s a matching character if there is, remove it from both lists and create a third list that concatenates both lists with an asterisk in between. Use a nested for loop to iterate over both lists. Define a function, remove_match_char() that accepts two lists as input.

#Mplay pygame code#

You can find the source code of the FLAMES game using Python in this GitHub repository.










Mplay pygame