# createPopupMenu not working with Ubuntu (Xorg)

**URL:** <https://forum.inductiveautomation.com/t/createpopupmenu-not-working-with-ubuntu-xorg/23802>\
**Category:** Ignition\
**Tags:** python, ignition79, scripting\
**Created:** [April 2, 2019, 9:25pm UTC](https://forum.inductiveautomation.com/t/createpopupmenu-not-working-with-ubuntu-xorg/23802 "2019-04-02T21:25:40Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![bfuson](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/bfuson/32/4597_2.png) [@bfuson](https://forum.inductiveautomation.com/u/bfuson)\
**Post date:** [April 2, 2019, 9:25pm UTC](https://forum.inductiveautomation.com/t/createpopupmenu-not-working-with-ubuntu-xorg/23802/1 "2019-04-02T21:25:40Z")

</div>

Using [system.gui.createPopupMenu](https://docs.inductiveautomation.com/display/DOC79/system.gui.createPopupMenu) to instantiate simple quick-menus on templates.

Works as expected on every Windows install I’ve tried. Recently was ‘gifted’ a Xubuntu development environment by the almighty cloud. Even the most basic case found in the user manual fails to popup.  
Confirmed the issue with another vanilla Ubuntu VM.

Any tips or workarounds to ensure this plays well on all platforms?

---

<div class="post-metadata">

**Author:** ![bfuson](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/bfuson/32/4597_2.png) [@bfuson](https://forum.inductiveautomation.com/u/bfuson)\
**Post date:** [April 2, 2019, 9:29pm UTC](https://forum.inductiveautomation.com/t/createpopupmenu-not-working-with-ubuntu-xorg/23802/2 "2019-04-02T21:29:37Z")

</div>

After pausing for a moment to actually reflect on the linked docs, this passage stood out:

> Then, call the show(event) function on both the mousePressed and mouseReleasedevents on your component. The reason for this is that different operating systems (Windows, Linux, MacOS) differ in when they like to show the popup menu. The show(event) function detects when the right time is to show itself, either on mouse press or release. See the examples for more.

Indeed including the same code in BOTH mousePressed and mouseReleased seems to work as intended.

---

<div class="post-metadata">

**Author:** ![bfuson](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/bfuson/32/4597_2.png) [@bfuson](https://forum.inductiveautomation.com/u/bfuson)\
**Post date:** [April 2, 2019, 9:30pm UTC](https://forum.inductiveautomation.com/t/createpopupmenu-not-working-with-ubuntu-xorg/23802/3 "2019-04-02T21:30:28Z")

</div>

Still wondering about this bit though:

> It is best to have the menu object created only once via an application specific library function.

Does that imply instantiate from a shared script? Or call createPopup once during startup and store the reference in a global somehow?

---

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [April 2, 2019, 9:32pm UTC](https://forum.inductiveautomation.com/t/createpopupmenu-not-working-with-ubuntu-xorg/23802/4 "2019-04-02T21:32:13Z")

</div>

> [@bfuson](#):
>
> Does that imply instantiate from a shared script? Or call createPopup once during startup and store the reference in a global somehow?

There are a variety of options. I would tend to keep the scope as local as possible - add a custom method to the component which will construct the popup menu, then cache the constructed menu locally (using `self.putClientProperty`. Structure the function so that it first looks for a cached instance, and then if one is not found, builds it (and puts it in the cache!) then returns it. Then just call your custom method from each mouse event handler.
