An optionmenu is a UI construct that presents the user with a list of options.
Questions tagged [optionmenu]
453 questions
6
votes
1 answer
how to attatch scrollbar to dropdown list in tkinter?
from Tkinter import *
master = Tk()
variable = StringVar(master)
variable.set("one") # default value
w = OptionMenu(master, variable, "Carrier 19EX 4667kW/6.16COP/Vanes", "Carrier 19EX 4997kW/6.40COP/Vanes", "Carrier 19EX…

Manikanta P
- 2,777
- 2
- 19
- 22
6
votes
6 answers
Python Tkinter: OptionMenu modify dropdown list width
I have created an OptionMenu from Tkinter with a columnspan of 2. However, the dropdown list/menu does not match the width, so it does not look good. Any idea on how to match their width?
self.widgetVar = StringVar(self.top)
choices = ['', 'wire',…

James the Great
- 941
- 2
- 14
- 46
6
votes
3 answers
Avoiding Tkinter OptionMenu button resizing
I've the following OptionMenu:
self.textoprioridad = Label(self.frameTwo, text = "Prioridad: ", justify="center")
self.textoprioridad.grid(row=n, column=4)
var2 = StringVar()
menu2 = OptionMenu(self.frameTwo, var2, "Primera pieza", "Esta semana",…

Avión
- 7,963
- 11
- 64
- 105
5
votes
1 answer
Click on menu-item that is sometimes in the overflow-menu
currently to click on menu-item that is sometimes on some devices in the overflow-menu I am doing the following:
fun invokeMenu(@IdRes menuId: Int, @StringRes menuStringRes: Int) {
try {
onView(withId(menuId)).perform(click())
} catch (nmv:…

ligi
- 39,001
- 44
- 144
- 244
5
votes
0 answers
Android custom option menu item
everyone! I have question for Android guys. Any help or suggestion will be appreciated.
So my problem:
I have application with ActionBarCompat and in this action bar I have a lot of different hiden menu items, which appear only if user click on…

Vito
- 1,414
- 1
- 13
- 22
5
votes
3 answers
OptionMenu won't show the first option when clicked (Tkinter)
I added a OptionMenu widget to my code, and assigned a list as it's options. This is how it is:
z = StringVar()
z.set(userList[0])
usersOption = OptionMenu(frame1, z, *userList)#, command=changeUser)
usersOption.pack(side=RIGHT, padx=3)
Now,…

AugustoQ
- 497
- 1
- 6
- 16
5
votes
7 answers
Unable to hide the virtual keyboard of SearchView iconfiedbydefault(false)
I have a search view which is set as expanded by default with default search query but i don't want the virtual keyboard.In below code i tried to hide keyboard in onCreateOptionsMenu but still keyboard is visible.
imm =…

user1526671
- 817
- 4
- 16
- 33
5
votes
2 answers
Can't open optionsMenu programmatically without a user click
In my project i am trying to open the optionsMenu programmatically without a click on the menu key from the user. I have tried openOptionsMenu() but it gives me an error like this android.view.WindowManager$BadTokenException: Unable to add window…

Droid_Dev
- 1,162
- 1
- 8
- 25
4
votes
2 answers
How would I create a Spinner for use as an Action Item?
(Android 3.0+) How would I create a Spinner for use as an Action Item for Android Honeycomb's Action Bar? I understand that the Action Bar's LIST mode pretty much does that, but I would like to use its TAB mode instead. Since, as far as I know, I…

Jack
- 43
- 1
- 4
4
votes
1 answer
onOptionsItemSelected in Menu is not clickable for item using actionLayout
I have an android app with options menu, and the first item is defined with "actionLayout":
menu.xml snippet:
-

user1616685
- 1,310
- 1
- 15
- 36
4
votes
3 answers
Android option menu - one menu item in a single row
I am trying to use option menus for my application . When I add 2 MenuItem it shown in a single row, but i need only one item in a row and other in next row. Please help me.
Thanks..

Aswini K
- 215
- 1
- 5
- 12
4
votes
5 answers
MenuItem icon is not displaying correctly in RTL Layouts
In RTL, option menu item icon not displayed correctly!!
but in LTR, everything is displayed well and beautifully.
With the help of this command, I make the RTL program
getWindow().getDecorView().setLayoutDirection(View.LAYOUT_DIRECTION_RTL);
My…

Shahram
- 43
- 5
4
votes
2 answers
Running commands based on OptionMenu's selection
How can I tweak this so that if xyz17 is selected from the Menu the function xyz17() is run?
I'm aware of command = xyz17 but I'm not sure how to make that dynamic so that it depends on the menu selection.
from tkinter import *
def xyz17():
…

jim bob
- 53
- 6
4
votes
3 answers
Tkinter StringVar get index of selected option
I'm using a OptionMenu to select an option from a dropdown
self.var = tk.StringVar()
tk.OptionMenu(self, self.var, *self.options)
The options could contain duplicates
Because of this, when I want to know which option is selected I need to know its…

Blimmo
- 363
- 3
- 11
4
votes
1 answer
Get a list of all options from OptionMenu
I want to get a list of all options from an OptionMenu widget in tkinter like so:
import tkinter
root = tkinter.Tk()
var = tkinter.StringVar(root)
var.set('OptionMenu')
optionMenu = tkinter.OptionMenu(root, var, 'foo1',…

TheLastOfTheMoops
- 61
- 10