Getting started with viple (4)

(1) Line printing

It is mainly used to display data in the running window and automatically wrap lines after printing is completed.

Note: Two data cannot be printed at the same time, for example

Solution 1: Use OR and merge so that only one data is printed each time it enters the row. Disadvantage: OR and merge activities do not wait, resulting in the printing order of the two data being unfixed.

Solution 2: Splicing printing can ensure that the order of the two output data is fixed.

Solution 3: Print separately. Disadvantage: The printing order cannot be fixed.

Which solution to choose depends on the actual needs of the project.

In the same way, assigning two variables to one variable will cause the same problem.

This kind of error should be avoided in the program. If it happens accidentally, read the error message in time, find the cause of the error, and make corrections.

(2) Simple conversation

There are two types of simple dialogs, namely alert dialog boxes and interactive dialog boxes.

1. Warning dialog box

Mainly for warning effect, warning data information needs to be passed in.

running result

It can be seen from the operation that the warning information goes through a simple dialogue and the data is stored in the value; the warning dialog box will pop up a dialog box to display the warning content. After clicking OK, the pop-up box disappears.

2.Interactive dialog box

Users can interact with programs.

Running effect: The prompt text is displayed by default. Secondly, the default value is given. After clicking OK, the data is read and printed.

If the default value is changed to Linda in the pop-up InputDialog, the printing result will change accordingly.

To sum up: the data stored in the interactive dialog box is also in value, and the user can modify it.

In a warning dialog box, the user cannot enter data; in an interactive dialog box, the user can enter data and interact with the program.

Interactive dialog box: You can set a default value. If the user has input, the default value will be overwritten. If there is no input, the default value will be used.

(3) Text to speech

Read the entered data. You need to turn on the audio to hear the sound, which is TTS (Text-to-speech) in English.

Note: Audio needs to be turned on to run this program.

(4) Random

Used to generate a random number, the maximum range needs to be given.

For example: Randomly generate a random number within 100

Run multiple times, the random numbers generated are different.

(5) Code activities-python

You can write python code, you need to configure the local python environment or conda environment

If the conda environment is configured, then:

After the configuration is completed, click Edit Code to write a Python program

(6) Code activities-c#

Similar to python, but the syntax must use C# syntax

After dragging into the code activity C#, you need to set the class name and set it to Test

Right-click and select Edit Code, get the value input from outside, then print Hello world, and finally output the string.

test

(7) Key event

Executed when most keys on the keyboard are pressed.

Click the drop-down list and select the button as a

After running, the program is blank. When the letter key a on the keyboard is pressed, printing is performed. Moreover, the letter key a can be pressed multiple times to perform multiple printings.

(8) Key release event

Most of the keys on the keyboard are pressed, and when they are lifted up, they are executed when the keys rebound. The key release event does not need to set the specific key that is bounced. It can be triggered as long as the key is bounced.

When running, you can press any key randomly and execute it when you release it (the following test is to press a and s, readers can press other keys for testing)

(9) Timer

There must be a time before the timer, the unit is ms, used for timing. Assuming it is set to 1000, it means the timing is 1 second

When the button is released (pops up), you need to wait for one second before the data will be printed.

Guess you like

Origin blog.csdn.net/songxiaolingbaobao/article/details/134262024