Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9272585
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T15:54:26+00:00 2026-06-18T15:54:26+00:00

In the minimal example given below, the context menu (right click on white section

  • 0

In the minimal example given below, the context menu (right click on white section of the gui) is displayed only briefly and then disappears. This is the case if the app is started from the IPython (0.13.1) console. When started normally from shell it works as it should.

import sys
from PySide import QtGui, QtCore
from IPython.lib.guisupport import get_app_qt4, start_event_loop_qt4

class ContextTestGui(QtGui.QMainWindow):
    def __init__(self):
        QtGui.QMainWindow.__init__(self)
        self.ui = Ui_ContextTestWindow()
        self.ui.setupUi(self)
        self.ui.treeView.addAction(self.ui.actionCopy)
        self.ui.treeView.addAction(self.ui.actionShow)

class Ui_ContextTestWindow(object):
    def setupUi(self, ContextTestWindow):
        ContextTestWindow.resize(200, 100)
        self.treeView = QtGui.QTreeView(ContextTestWindow)
        self.treeView.setContextMenuPolicy(QtCore.Qt.ActionsContextMenu)
        self.treeView.setMinimumSize(QtCore.QSize(100, 100))

        self.actionCopy = QtGui.QAction("Copy",ContextTestWindow)
        self.actionShow = QtGui.QAction("Show",ContextTestWindow)

def create_window(window_class,**kwargs):
    app = get_app_qt4(sys.argv)
    window = window_class()
    window.show()
    start_event_loop_qt4(app)
    return window

if __name__ == '__main__':
    simgui = create_window(ContextTestGui)
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T15:54:27+00:00Added an answer on June 18, 2026 at 3:54 pm

    I believe this is IPython Issue #2380, which should be fixed in current git master.

    If you want your app to workaround this bug in 0.13, you will have to ship with your own code a version of IPython/lib/inputhookqt4.py from master, and monkeypatch IPython with:

    from IPython.lib import inputhook
    inputhook.enable_qt4 = my_enable_qt4
    

    OR, alternatively, just override create_inputhook_qt4

    from IPython.lib import inputhookqt4
    inputhookqt4.create_inputhook_qt4 = my_create_inputhook_qt4
    

    I expect both approaches should work, as long as you do it before %gui qt is called.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Given the minimal C++11 STL example: set<int> S = {1,2,3,4}; for(auto &x: S) {
Given the following minimal working example: from pyparsing import * latex_h = QuotedString($)('latex') reg_text
Anyone have an minimal example of ASP.NET MVC and dotnetcharting.com control lying around? Thanks,
EDIT I isolated a real minimal example which does not work (it is a
I'm trying to customise the sc-player-minimal.html example included with the JS custom player package.
Consider the following minimal example. #include <vector> class Data { std::vector<int>& v; public: Data(std::vector<int>&
I've tried to reduce it to the minimal example. The code runs without an
Given this simple example that I got from the JOGAMP wiki, why would the
I took the minimal PDF example in the PDF specification from PDF Specification ,
Here is a minimal working example describing my current situation. The file main.cpp #include

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.