gtk3 combobox

The combobox shows nothing?
Then you lack a renderer.
add it this way:

addnodecombo = self.builder.get_object("addnodecombo") # in my case get the combo box from gtk.Builder
addnodecomborender=Gtk.CellRendererText() # create a renderer
addnodecombo.pack_start(addnodecomborender, True) # add the renderer (what True does I haven't looked up)

# set the column (in my case 0)
# this can be a different column as the id column.
# what "text" does is most probably setting a column name which isn't shown. I think it can be everything
addnodecombo.add_attribute(addnodecomborender, "text", 0)


how to use gtk3 treestore in pygobject

1. Step:
create a treestoremodel
model=Gtk.TreeStore(str,str) (or use Gtk.Builder for this)

2. Step:
add an entry in the highest level and take its iterator. This can be done with
it=model.insert_with_values(None, -1, [0,1], [“hello”, “world”])
None: parent (None is the highest level)
-1: the last position=appending
[0, 1]: the columns
[“hello”,”world”]: fills the selected columns with values
it: the iterator, it becomes important for the next step

3. Step:
now we have an iterator. In the first call of insert_with_values we used None.
This is replaced by the iterator. And voila a child object

model.insert_with_values(iter, -1,[0,1],[“hello”,”child1″])
model.insert_with_values(iter, -1,[0,1],[“hello”,”child2″])

The last thing to do is to add the treestore to a treeview and add some Renderers for the columns,
but for that there is already a tutorial:

little vte tutorial (C/C++)

You use gtk for your progam and want a little terminal in it? For this is the vte (virtual terminal emulator) widget the right choice. But you won’t find a tutorial how to do this in C (or C++).  This is why I create this little tutorial.

The first thing you need to do is to include the right header (vte/vte.h) and choose in pkg-config the right vte version (gtk2/gtk3).
To create a terminal object use: vte_terminal_new().
This function will return a GtkWidget* which can be included normaly.
But now you have problem with the vte intern methods: they demand a terminal object.
This problem is solved via the VTE_TERMINAL( vteterm) wrapper which transforms the GtkWidget* back into the terminal.

The next thing to do is to start a shell  in the terminal. Don’t start programs directly (except you have special wishes); this can be done with vte_terminal_feed_child more comfortable.
For this create an char* array with two (or more fields if you want to add arguments for the shell)  and fill them with 0/NULL ({NULL,NULL})
Then replace the  [0] cell with a path to the shell you like to use in the terminal. Important is that the array ends with NULL/0.

char *startterm[2]={0,0};
or more elegant:
startterm[0]=vte_get_user_shell(); //returns default shell

This strange construct is needed for a function with the clumsy name:
Here an example to explain the arguments:

                                       VTE_PTY_DEFAULT, //how the shell is started
                                       NULL,  //working directory; set to NULL for default
                                       startterm, //here include the strange construct
                                       NULL, //NULL or another strange construct containing the environment variables
                                       (GSpawnFlags)(G_SPAWN_DO_NOT_REAP_CHILD | G_SPAWN_SEARCH_PATH),  //Spawnflags
                                       NULL, //setup function
                                       NULL, //pointer to child data
                                       &pidterm, //either NULL or reference to GPid object in this case (GPid pidterm;)
                                       &err); //either NULL or reference to GError* object; important GError* must be set on 0 before using

Please have a look into:
to see what the arguments do exactly.

Let’s come to some working control commands for the terminal:

vte_terminal_feed (feeds terminal without interpretation by child (started shell)):

char *t="test"
 vte_terminal_feed (VTE_TERMINAL(vteterm),t,4);
 4 is the length of the char * array. This will print the message: "test" in the terminal.

vte_terminal_feed_child (interprete string with child):

char *t="echo \"test\""
vte_terminal_feed_child (VTE_TERMINAL(vteterm),t,11);
11 is the length of the char * array. The child will print the message: "test" in the terminal.

The child can also be fed with a binary (the syntax is the same). But I don’t know an example for this :