官术网_书友最值得收藏!

Showing information with showinfo

You should be able to see what the two arguments to showinfo do.

The first argument is the window's title bar text. If you didn't notice, click the Say Hello button again – you should see the word Hello inside the title bar of the pop-up window.

Clicking the Say Goodbye button will yield a pop-up message with Goodbye! in the title bar.

The second argument is a string containing the information which will be written inside the box.

The showinfo box contains just one button—an OK button. Clicking this button dismisses the window:

A showinfo box

While a messagebox window is displayed, the main window is effectively paused. The Say Goodbye button demonstrates this well. The line which tells the main window to close after 2 seconds does not get executed until the messagebox is dismissed.

Try clicking the Say Goodbye button and waiting for more than 2 seconds. You will see that the main window stays open until 2 seconds after you click OK to close the messagebox window. This is important to remember.

If, for example, you are processing a large list of items and you wish to alert the user to their status, it's best to wait until all of the items are processed before using showinfo. If you put a showinfo box after each item, the user will have to continually close them in order to allow the main window to continue processing.

主站蜘蛛池模板: 黎川县| 盐津县| 海南省| 岳阳市| 五台县| 阳西县| 乌兰察布市| 景谷| 揭东县| 日土县| 克山县| 广汉市| 拜城县| 铁力市| 额尔古纳市| 邵东县| 大渡口区| 斗六市| 双桥区| 远安县| 嵩明县| 吴川市| 仪陇县| 饶平县| 连江县| 修水县| 山东省| 呼和浩特市| 漳浦县| 张家港市| 兴化市| 疏附县| 瑞昌市| 上饶市| 阿鲁科尔沁旗| 磐石市| 泰来县| 巴中市| 仙游县| 夏河县| 沾化县|