1

Is there a way to get the window in which we are with a python script in a running program that allows python scripts?

The program I'm talking about is dia, that is written in C, which opens all the python scripts stored in the correct folder when ran. For example, if the simple following script is stored in .dia/python

print "Something"

that's what happens when I run dia

$ dia &
$ Something

So it's easy to import a script, but now what I want is to get the window, to be able to manipulate it (for example do changes on menu) or call other gtk functions, for example to add an hotkey into the application.

user10207893
  • 243
  • 1
  • 2
  • 11

1 Answers1

0

Have you tried the examples in the python dir of you dia installation? From inspecting that python plugins directory, dia.register_action seems to be what is used to manipulate menus.

liberforce
  • 11,189
  • 37
  • 48
  • I've already used it, it allows to add an item to the menu but it doesn't permit to set it an hotkey (called accelerator). `dia.register_actions` calls `gtk_action_group_add_action` instead of `gtk_action_group_add_action_with_accel` and the hotkey is properly what I need. That's why I'm looking for something general (not specific to dia), cause dia is not thought to do some things I need. – user10207893 Oct 09 '18 at 15:55