简体   繁体   中英

Python easygui module multchoicebox preselect

The multiple choicebox in easygui always seems to have an option selected by default. The option selected can be changed with the preselect parameter based on the index of the desired option. Is there a way to make it so that there is no option selected at all to begin with? I've tried preselect=False and that just gives me the option at index 0. The default is also 0.

import easygui

choices=['Big','Medium','Large','Extra Large']
title='Available Sizes'
selection=easygui.multchoicebox('Choose shirt size',title,choices,preselect=2)
print(selection)

This example code will return:

['Large']

As it is now, the user needs to clear the preselected option if it's not wanted.

preselect=None does the trick. Should have known. Just wanted to post in case it helps somebody else out.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM