we add one more function to our code for players entry so that to clear screen for the game.now we need to modify the last two functions as for CUI to bring in graphics.we initialise the tkinter first and give title in title bar:Ĭanvas1 = tk.Canvas(root, width = 1080, height = 800, relief = 'raised').first we need to import the following libraries:įrom tkinter import Tk, RIGHT, BOTH, RAISEDįrom tkinter.ttk import Frame, Label, Button, Style.check if 0 then call thanking function and break the loop.now take input to continue = 1 or end = 0.same for both players code, update value of turn by 1.again use if else to check answer given and update the score. from If we check turn = even then player 1 Else player 2 chance, but the code is same except naming.now we use If-Else to create a question answer format similar to both players.create a question word with the function calling.declare computer’s task to choose a word from library created.now start a loop ( while (1) ), 1 because we want to continue untill the players want.declare two variables for points, initially as zero.declare two variable and take name of players.Jumbled="".join(random.sample(word,len(word))) choose a random word in the following way.create a list of words, with as many words you want.We will be doing it in parts and combine in one to make it work, before that in the first two lines import random, import pygame:-ġ. I prefer VS code as it completes the code from its libraries and themes are attractive. A text editor ( Visual Studio(VS) Code/Atom/Sublime/Notepad ) to code.I prefer chrome or firefox as it provides a console to see behind the work of program like like the IDE of python ( to use just right-click on mouse and select ‘Inspect’ or Ctrl+Shift+I to open it and switch to console tag in this window) A Browser ( Chrome/Firefox/Opera/Safari/IE) to run the program.One Laptop or Desktop with any OS (Linux/Windows/iOS).
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |