Python's Little Turtle tutorial Easygui

Source: Internet
Author: User
Tags button type

Blog transfer from

51933427

Finally a bit of substance can see touched the interface, searched a bit although easygui with not much, but as a start, first understand it, after all, the truth figured.

Following the little turtle's code, knock it over.

Import Easygui as G
Import Sys

While 1:
G.msgbox (' Hi, Welcome to the first interface mini-game ') #msgbox其实还可以设置第二个参数, the second parameter represents the text above the title bar, as in the following MsgBox ' Results '


Msg= ' What kind of knowledge do you want to learn in the fish C studio? ‘
Title= ' Small game interaction '
Choices=[' love ', ' programming ', ' Ooxx ', ' four arts '


Choice=g.choicebox (msg,title,choices) #还没看文档, but this choicebox function should be able to accept several parameters, including the title of the top bar, options, the subject sentence


G.msgbox (' Your choice is: ' + str (choice), ' result ')


msg = ' Do you want to start the little game again? ' ‘
title= ' Please select '


If G.ccbox (msg,title):
Pass
Else
Sys.exit (0)

The activation interface is as follows:

--------------------------------------------------------------------------------------------------------------- --------------------------------------------------------------------------------------------------------------- -------

Here is the explanation, the Easygui function can also accept the keyword parameter

Then, we can modify the text of the button itself, Ok_button is the name of the original parameter!! , but note the order of each parameter, for example, if you want to change the title name, you have to write this argument in front of the Ok_button.

Next down is ccbox,cc continue or cancel.

He returns 1 and 0, but does not mean true and false, but in the if still can use 1 and 0, in addition, the option can add, oneself arbitrarily.

This is about Buttonbox, which is a bit like the Choicebox function, but the difference is that Choicebox is similar to a drop-down list, and the button is a button type.

The following 2 features are only different on the return value, do not understand why there is such a difference

The following is a very important link, is to talk about inserting pictures, but Easygui only accept pictures in GIF format, the following is the tutorial and self-made examples

The following choicebox, he applies to what situation? Is that there are too many options, resulting in a buttonbox that will pull the interface too big.

Here are the tutorials and examples of what you do

The next section is important to let users enter content, tutorials and testing as follows:

A chapter is more important than a chapter, here is a function of multiple filling functions, multenterbox, specific tutorials and experiments are as follows:

Here is the PasswordBox function, which you can use to represent the input function as an asterisk

And then this is a multi-entry function that can have multiple options to enter

The next paragraph is a function for displaying text content, a textbox

Then there is the function function of the Browse folder Diropenbox

Tutorials and experiments are as follows

Next is the code to open the file, and the tutorials and experiments are as follows:

Then is the function to save the file Filesavebox, tutorial and experiment as follows

Finally, is a catch exception, relatively simple, just write a sentence exceptionbox can use a popup box to display the error content

Python's Little Turtle tutorial Easygui

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.