Example Analysis of python graphical user Interface
Editor to share with you a sample analysis of the python graphical user interface, I believe that most people do not know much about it, so share this article for your reference, I hope you can learn a lot after reading this article, let's go to know it!
Graphical user interface of python
Python's graphical user interface msgbox's use of ccbox's use of buttonbox's use of buttonbox to add pictures multchoicebox's use
The use of msgbox
The magbox () function displays a message and a button that provides an ok
Example 1:
Import easygui as AXAX.msgbox ("Hi, welcome to the\ nfirst\ ninterface Mini Game", "zhaojie")
The use of ccbox
The ccbox () function provides a choice: C [o] ntinue or C [a] ncel (press keyboard'o' or keyboard'a 'instead of mouse operation, and the letters enclosed in [] are the corresponding keys. Of course, continue and cancel can also be designed according to their own needs)
Example 2:
Import easygui as AXimport sys msg = "excuse me, are you handsome?" title = "Magic Mirror" choices = ('yes ([y])', 'not ([n])') AX.ccbox (msg, title,choices)
The use of buttonbox
The usage of the buttonbox () function:
Buttonbox (msg =', title ='', choices = ('button [1]', 'butthon [2]', 'button [3]'), image=None,default_choice=None,cancel_choice=None,callback=None,run=True) example 3:import easygui as AXimport sys### is written 1###msg ='am I a handsome guy?' Title = 'Magic Mirror' choices = ('handsome ([1]),' very handsome ([2]), 'the most handsome ([3])') AX.buttonbox (msg,title,choices) # write 2###AX.buttonbox (msg ='am I a handsome guy?' , title = 'Magic Mirror', choices = ('handsome ([1])', 'very handsome ([2])', 'most handsome ([3])'), image=None,default_choice=None,cancel_choice=None,callback=None,run=True)
Buttonbox add Picture
Display pictures in buttonbox:
Notice that image = None in the buttonbox function above, so you just need to change None to the corresponding picture
Import easygui as AXimport sys#### writes 1####msg ='am I a handsome guy?' Title = 'Magic Mirror' choices = ('handsome ([1])', 'very handsome ([2])', 'most handsome ([3])') image = 'OIP-C.jpg'AX.buttonbox (msg,title,choices,image) # write 2###AX.buttonbox (msg =' am I handsome?' , title = 'Magic Mirror', choices = ('handsome ([1])', 'very handsome ([2])', 'most handsome ([3])'), image='OIP-C.jpg',default_choice=None,cancel_choice=None,callback=None,run=True)
The use of choicebox
Use of choicebox:
The choicebox (msg='',title='',choices= [], preselect=0,callback=None,run=True) choicebox () function provides a list of choices, import easygui as AXimport sysAX.choicebox (msg=', who is the handsome guy?' Title=' touched his conscience and said,', choices= [Sun Xing, Sun Xing, Sun Xing Sun], preselect=0,callback=None,run=True)
The use of multchoicebox
The usage of multchoicebox:
Like choicebox, multiple choices are supported
Import easygui as AXimport sysAX.multchoicebox (msg=', who is the handsome guy?' Title=' touched his conscience and said,', choices= [Sun Xing, Sun Xing, Sun Xing Sun], preselect=0,callback=None,run=True)
The above is all the contents of the article "sample Analysis of python graphical user Interface". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!