Python-guess-word Games

Source: Internet
Author: User

The code works as follows:

Attention:

1. Must be in the PYTHON3 environment to want to use

2.qq:3084276329 (Exchange study together)

3. Also please comment

Guess the word Game code is as follows:

1#! /usr/bin/env python2#-*-coding:utf-8-*-3 # Guess The word game4# Blog: https://WWW.CNBLOGS.COM/MUXII5 # the wood.6 Import Tkinter7 Import Threading8 Import Time9  fromTkinter Import *Ten  fromTkinter Import MessageBox One  fromTkinter Import MessageBox A  -Root =Tkinter. Tk () -Root.title ('The wood-guess the word.') theRoot.minsize ( -, the) -  -Label =(Root) -Label = label (Root,text ='Blog: https://www.cnblogs.com/muxii/\nqq:3084276329\n —-———— that wood ——-———', Font = ('Microsoft Ya-Black', One), FG ='Red') +Label.grid (row =0, column =0) -BTN1 = Tkinter. Button (Root,text ='1', width =5, height =2, bg='Blue') +Btn1.place (x= -, y= -) ABTN2 = Tkinter. Button (Root,text ='2', width =5, height =2, BG =' White') atBtn2.place (x= -, y= -) -Btn3 = Tkinter. Button (Root,text ='3', width =5, height =2, BG =' White') -Btn3.place (x= the, y= -) -Btn4 = Tkinter. Button (Root,text ='3', width =5, height =2, BG =' White') -Btn4.place (x= the, y= $) -Btn5 = Tkinter. Button (Root,text ='5', width =5, height =2, BG =' White') inBtn5.place (x= the, y= -) -Btn6 = Tkinter. Button (Root,text ='6', width =5, height =2, BG =' White') toBtn6.place (x= the, y= About) +Btn7 = Tkinter. Button (Root,text ='7', width =5, height =2, BG =' White') -Btn7.place (x= the, y=280 ) theBTN8 = Tkinter. Button (Root,text ='8', width =5, height =2, BG =' White') *Btn8.place (x= the, y=280) $Btn9 = Tkinter. Button (Root,text ='9', width =5, height =2, BG =' White')Panax NotoginsengBtn9.place (x= -, y=280 ) -Btn10 = Tkinter. Button (Root,text ='Ten', width =5, height =2, BG =' White') theBtn10.place (x= -, y=280) +Btn11 = Tkinter. Button (Root,text =' One', width =5, height =2, BG =' White') ABtn11.place (x= -, y= About) theBtn12 = Tkinter. Button (Root,text =' A', width =5, height =2, BG =' White') +Btn12.place (x= -, y= $) -Herolists =[Btn1,btn2,btn3,btn4,btn5,btn6,btn7,btn8,btn9,btn11] $  $Isloop =False -  -Stopsing =False the #定义停止id -Stopid =NoneWuyi  the #定义函数, the loop option sets the background color, the selected red, - def round (): Wu     GlobalIsloop -     GlobalStopid About     ifIsloop = =True: $         return -i =1 - #判断一个对象是否已经类型 Type - #考虑继承关系 A     ifIsinstance (Stopid,int): +i =Stopid the  -      whileTrue: $         # theTime.sleep (0.05) #延时 the          forXinchherolists: thex['BG'] =' White' the  -herolists[i]['BG'] ='Blue' in  thei + =1 the  About  the         ifI >=Len (herolists): thei =0 the  +         ifStopsing = =True: -Isloop =False theStopid =IBayi              Break the  the #停止 - def STOP1 (): -  the     Globalstopsing the  the     ifStopsing = =True: the         return -Stopsing =True the  the #开始 the def newtask ():94     GlobalIsloop the     Globalstopsing theStopsing =False the #建立线程98t = Threading. Thread (target =round) About T.start () -Isloop =True101 102Btn_start = Tkinter. Button (Root,text ='Start', BG ='Red', command =NewTask)103Btn_start.place (x= -, y=175)104 # theBtn_stop = Tkinter. Button (Root,text ='End', BG ='Yellow', command =stop1)106Btn_stop.place (x= the, y=175 )107 108Root.mainloop ()

2018.8.3

Python-guess-word Games

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.