optionmenu

Click on menu-item that is sometimes in the overflow-menu

此生再无相见时 提交于 2019-12-10 09:24:35
问题 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: NoMatchingViewException) { openActionBarOverflowOrOptionsMenu(InstrumentationRegistry.getInstrumentation().targetContext) onView(withText(menuStringRes)).perform(click()) } } But I am searching for a better approach - ideally something where I just have to

MenuPopupHelper cannot be used without an anchor

三世轮回 提交于 2019-12-08 17:37:47
问题 I want add PopupMenu to my MenuItem . Menu.xml <?xml version="1.0" encoding="utf-8"?> <menu xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto"> <item android:id="@+id/date" app:showAsAction="ifRoom|withText" android:title="Date" android:visible="true"/> <item android:id="@+id/category" app:showAsAction="ifRoom|withText" android:title="Category" android:visible="true"/> </menu> When I click on MenuItem I call this code: @Override

Default to and select first item in Tkinter listbox

我们两清 提交于 2019-12-07 02:47:12
问题 I want to automatically select the first item in the listbox. By selecting the first item, I don't mean simply defaulting to the first item or setting focus on it. I've already achieved that by doing self.listbox.select_set(0) . I want the default item also selected . In other words, when I run my code below, I want print(value) to print the value of the default selection. If Asia is chosen from the optionmenu, Japan should automatically print to the console. If Africa, Nigeria should print

How to change menu background color of Tkinter's OptionMenu widget?

强颜欢笑 提交于 2019-12-07 01:48:54
问题 If I take a simple example of OptionMenu from http://effbot.org/tkinterbook/optionmenu.htm, and add a line that sets background color (see below), only the button background changes color, not the drop-down menu which remains gray. Can I set color for both the button and the menu of OptionMenu? I am using Windows 7, Python 2.6.6, Tkinter Rev 73770 from Tkinter import * master = Tk() variable = StringVar(master) variable.set("one") # default value w = OptionMenu(master, variable, "one", "two",

Best practices for implementing a multi-level Option Menu on Android?

六月ゝ 毕业季﹏ 提交于 2019-12-07 00:18:13
问题 I'm currently working on a port of an iPhone app into an Android. The iPhone app has a custom global navigation menu at the bottom of the screen, and when bringing this over to Android, it was suggested to replace this custom menu with the generic Option Menu (invoked via the option key on the device) to give it a more native Android look and feel. The issue is that the menu itself has several layers (e.g. Three main option like A, B, C, and sub-options like A1, A2, A3). I've looked around

doesn't call onMenuItemClick for first time - SherlockListActivity

北战南征 提交于 2019-12-06 16:08:46
问题 I use SherlockListActivity, I created ActionBar with one item & its clickListener when i click on it for first time after creating activity, doesn't call onMenuItemClick, but in every click after first click, work with no problem Why ? private void BuildTopActionBar() { BitmapDrawable bg = (BitmapDrawable) getResources().getDrawable( R.drawable.ic_action_bg); bg.setTileModeXY(TileMode.REPEAT, TileMode.REPEAT); getSupportActionBar().setBackgroundDrawable(bg); this.getSupportActionBar()

Python Tkinter: OptionMenu modify dropdown list width

安稳与你 提交于 2019-12-05 18:18:37
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', 'register'] typeOption = OptionMenu(self.top, self.widgetVar, *choices) typeOption.grid(column = 0, columnspan = 2, row = 0, sticky = 'NSWE', padx = 5, pady = 5) There is no way to change the width of the dropdown. You might want to consider the ttk.Combobox widget. It has a different look that might be what you're looking for. One idea is to pad the

Click on menu-item that is sometimes in the overflow-menu

痴心易碎 提交于 2019-12-05 17:53:07
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: NoMatchingViewException) { openActionBarOverflowOrOptionsMenu(InstrumentationRegistry.getInstrumentation().targetContext) onView(withText(menuStringRes)).perform(click()) } } But I am searching for a better approach - ideally something where I just have to know the menu-id. How do you do this in your espresso tests? Unfortunately, your ideal case cannot be

Default to and select first item in Tkinter listbox

与世无争的帅哥 提交于 2019-12-05 07:53:43
I want to automatically select the first item in the listbox. By selecting the first item, I don't mean simply defaulting to the first item or setting focus on it. I've already achieved that by doing self.listbox.select_set(0) . I want the default item also selected . In other words, when I run my code below, I want print(value) to print the value of the default selection. If Asia is chosen from the optionmenu, Japan should automatically print to the console. If Africa, Nigeria should print and Germany for Europe. Any suggestion on how I can achieve this? Thanks. from tkinter import * from

How to change menu background color of Tkinter's OptionMenu widget?

六月ゝ 毕业季﹏ 提交于 2019-12-05 06:07:54
If I take a simple example of OptionMenu from http://effbot.org/tkinterbook/optionmenu.htm , and add a line that sets background color (see below), only the button background changes color, not the drop-down menu which remains gray. Can I set color for both the button and the menu of OptionMenu? I am using Windows 7, Python 2.6.6, Tkinter Rev 73770 from Tkinter import * master = Tk() variable = StringVar(master) variable.set("one") # default value w = OptionMenu(master, variable, "one", "two", "three") w.config(bg = "GREEN") # Set background color to green w.pack() mainloop() Thank you You