0

Edit: Looks like im_append_menuitems is not the function to get a popup menu. Vte inherits from Gtk.Widget so the way to get a menu is probably to connect to a right mouse click and generate a custom menu. I will look into this and if it works that will be the answer.

I'm using gtk3 with python.

When opening a vte window created in python gtk I can do all the normal things one would expect from a terminal except right click for a dropdown menu.

In the C documentation there's vte_terminal_im_append_menuitems ().

I haven't tried it yet because it requires a GtkMenuShell and I've only used GtkMenu. So I might have trouble using it.

The documentation isn't the best for edge cases, and I'm using python which doesn't always have the bindings made right. Some of the abstract gtk classes I've tried in python have given me trouble too.

I'm wondering if there is an easier way than GtkMenuShell.

If not an example of GtkMenuShell would help.

In the meantime I'm going to try to do it on my own. If I come up with the code soon I'll post it as an answer.

Quentin Engles
  • 2,744
  • 1
  • 20
  • 33
  • **Do you have the sample code anywhere ?** I once worked with python and vte but that was quite long ago and I used subprocess to carry out the task for commandline and had problem to get the results in python variable. Looking at your answers, you seem to have solved that. – Samundra Apr 29 '13 at 19:21
  • @Samundra My answer over here works http://stackoverflow.com/questions/11804455/how-to-send-commands-to-pygobject-virtual-terminal/11810239#11810239 I haven't tried to get results of commands because I haven't needed them yet. There is a get_text function which you can use to get all the text and use a split and len function to get the last line after splitting on "\n". – Quentin Engles Apr 29 '13 at 19:48
  • @Samundra Something else to remember. When you use vte feedchild if you want the command to run automatically from a python variable you can append/concat a "\n" character to the end of the command. – Quentin Engles Apr 29 '13 at 19:53
  • @Samundra I will update that answer with better comments in the code. – Quentin Engles Apr 29 '13 at 19:56

0 Answers0