I looked into this a little more. It looks like using an overlay is the easiest
solution that I could find. You can override the render function of the cell
renderer but then you will probably need all the code in the text cell
renderer. This isn't too bad since the text cell renderer is
I see gtk_cell_renderer_render() in the documentation and it has a cairo_t to
draw with. I haven't tried to subclass from a treeview and override the
rendering. Something I should probably figure out. Do you know of an example of
doing something like this in C? Maybe I can put together a
The second cairo_t is used so that the rectangle can be lined up to the cell.
If I use the cairo_t in the "draw" callback then the rectangle doesn't line up.
gtk-app-devel-list mailing list
I gave what you said a try and it looks to work well enough. Then, how do you
get a box around a selected cell. It seems to me if you let the built in
renderer do it's thing and then get a cairo_t to just draw a rectangle after,
it should work, right? OK, a bit of a hack but it
I think that you would need to set up individual color columns so that you can
color individual cells in the table. For colors, “cell-background-rgba” gives
better color control but “cell-background” with html basic colors might be
//gcc -Wall stripe_list1.c -o
Have you tried
on the treeview? This might work to show a different background color on the
unused space of the treeview.
I don't know if this is of any help but also remember that you can set
individual row colors in a treeview by having a
It looks like the pixbuf sizes rendered are going to be tied to the size of the
font in the sourceview. If the pixbufs are bigger than the gutter has space for
then they get clipped. I don't know how the sourceview works very well myself.
Gave it a try. Maybe it will help.
Didn't get an attachment either. Try something like the following and see if it
makes any difference.
//Request a large drawing area.
gtk_widget_set_size_request(da, 1, 1);
I don't know if this is of any help. Another try at it. This one uses a
GtkApplication. Setup an action on the button along with the standard "clicked"
callback. A menu in there also.
//gcc -Wall toolbar2.c -o toolbar2 `pkg-config --cflags --libs gtk+-3.0`
"I am not sure what you mean"
I don't have a good answer for this. I see that GtkRadioToolButton is in the
list of Known Implementations for GtkActionable but doesn't use the GAction
The GtkToolbar doesn't implement the GAction interface so you are out of luck
You can use gtk_toggle_tool_button_get_active() to get the state of one of the
GtkRadioToolButton's in the toolbar.
//gcc -Wall toolbar1.c -o toolbar1 `pkg-config --cflags --libs gtk+-3.0`
You might be able to fiddle around with the newlines at the end of the buffer
to get something to work with the textview.
//gcc -Wall text_space1.c -o text_space1 `pkg-config --cflags --libs gtk+-3.0`
static void value_changed(GtkAdjustment *v_adjust, GtkWidget **widgets)
Try getting the vertical adjustment of the scrolled window and connect to
"value-changed". See if that will work. Something like
static void value_changed(GtkAdjustment *v_adjust, gpointer user_data)
GtkWidget *scroll=gtk_scrolled_window_new(NULL, NULL);
The function gtk_widget_override_font() is deprecated but as far as I know it
still works fine in GTK3.
With the Pango font description and the textview you should be able to set
everything up without getting any deprecated warnings. It doesn't set the
textview widget itself to
With gnuplot you can output to a file and then open the file with GTK+.
At one time gnuplot could directly write to GTK but that was a possible
security problem so it no longer works to do this.
Give this a try. It creates a surface, draws on it and then returns the surface
so that it can be put in an image widget.
from gi.repository import Gtk, Gdk
I am unfamiliar with Xcode but if you can compile the code at the command line
and have pkg-config working then check where the include files are that you
need and add them to your Xcode development environment. Try
pkg-config --cflags --libs gtk+-3.0
at the command line for your
With the text buffer and tag table you can get the text with pango attributes
or even rebuild pango markup for print output. This allows the pango markup to
be parsed into and then to be extracted from the text buffer without
loss(Easier said than done). You only need one text buffer to
The textview understands Pango markup. Maybe something to give a try. There are
a lot of text formats and you might have to do some text parsing depending on
the format. If it is possible to use gtk_text_buffer_insert_markup(), this can
save a lot of time dealing with text tags especially
Test setting up your callback with g_signal_connect_after. Then the location
iter should be at the end of the insert. Then the tag can be applied to the
//gcc -Wall highlight1.c -o highlight1 `pkg-config --cflags --libs gtk+-3.0`
Try a relational database. Sqlite is an easy one to use. It can sort and save
data to multiple tables. Use the list model and treeview to retrieve and view
the data. That way the columns can be set up dynamically along with the
renderer. Use SQL to update the database.
The other way to go about it is to just use cairo. I don't think that it will
give a speed improvement but it might be worth a try. I figure you are trying
to scale the png first and then draw it in a widget. Once the image is sized it
shouldn't be a problem to draw quickly.
I took a look at the stackoverflow discussion about this and there is some
sample code there to change colors of individual records in the treeview list.
You can no longer do even and odd colors in CSS but being able to connect a
cell renderer property to a column value can be very useful.
The textview widget has text tags built in that you can use to draw rectangles
around text. If you want to draw a rectangle to block out text you can match
the background and foreground colors. This code works on Ubuntu16.04, GTK3.18
and Python2.7. Give it a try and see
"1. It uses "QMenu" (from Gtk or Gio?) to build a menu structure. I would
prefere this way instead of an XML string. It should be possible
in Python, too? Gtk.Menu or Gio.Menu?"
My understanding of this is that the GMenu is used with the GtkApplication and
a GtkMenu is used with the "regular"
There is a basic setup for the Gtk Application in Python here
For C you can check
which has a menu but doesn't use builder
You have some options here. You can set a priority with
If you want to just stick with drawing in C, connect your "draw" handler for
the window. If you need a pixbuf you can
Is the issue that the widget is not yet drawn, so it size is not settled yet?
Total guesses: What about using g_signal_connect_after on size-allocate? Or
connecting to map-event signal on that widget? Or spinning on
gtk_events_pending() until all are done, then scroll down?
It looks like the new rows height isn't getting added to the adjustment. If the
height of the new row gets added to the upper value of the adjustment then the
last row of the list box can be shown when added. This is what I came up with
to test it out. Is this similar to what you
For effeciency, use one of the default cursors.
If you want, you can try creating your own cursor with animation and using
that. I got this working on my netbook which isn't a very high powered computer
I spend a bit of time drawing with cairo and GTK. If I get a drawing to work
out then maybe merge it into a widget for reuse. Sort of a bunch of rough
and then one back in Misc is
Not sure about your builder question and setting the width and height of the
drawing area there. For drawing lines though it looks like you are trying to
get the width and height of the GtkWindow instead of the drawing area. The
drawing area widget is passed to your "draw"
Try switching the sizing to what is needed. Something like
You should be able to resize columns if you want. If you have set sizes of text
to display in the tree view and want to allocate sizes you can do that.
Tested with Ubuntu16.04 and GTK3.18.
gcc -Wall tree_column1.c -o tree_column1 `pkg-config --cflags --libs
A list box is more flexible for allowing different widgets but the performance
might not be so good if you have a lot of rows. Don't have the numbers to show
You can put your individual widgets into a scrolled window if you want. The
scroll bars will show if the
Have you tried a GtkListBox for this? You can probably setup a scrolling window
in a row in a listbox.
gtk-app-devel-list mailing list
I found this bug for the scrollbar warning.
I don't know about the critical warning that you have or have a solution
figured out. I am not much help there.
This sounds similar to the problem Dino Aljević had in "Scrolled TreeView and
size allocation warnings" in this list in September?
I can get the warning
"(treeview4:3830): Gtk-WARNING **: Allocating size to GtkWindow 0x843e188
Thanks Matthias. I probably should have checked bugzilla first. Just rebuilt
GTK to version 3.22.26 and it works fine. There is no click through after
closing the expander.
gtk-app-devel-list mailing list
An out of sync reply. I must have accidently deleted your last response after I
read it. Also I didn't notice there were two mailing lists referenced. Probably
just need the app dev list.
It looks like it is a bug that has been recently introduced. If I test, test.c
If I try some test code... it should work. The code uses a grid instead of a
fixed container. Is this similar to what you have tried?
gcc -Wall buttons1.c -o buttons1 `pkg-config --cflags --libs gtk+-3.0`
Tested with GTK3.18 on Ubuntu16.04
I see "margin-left" is deprecated since version 3.12.
This might work. If you set the container margin of the grid and then
individually place your widgets in the locations that you want them,,,
hopefully no warnings. I don't get any warnings on GTK3.18. Will something like
This is similar but just using GTK. You get the iters for the start and end of
the range that you want to tag and apply the tag to it.
from gi.repository import Gtk
What language are you using?
I think that the best tutorial for GTK+ right now is the gtkmm tutorial. They
have a section on printing.
If you aren't programming in C++ the tutorial still is a good
The text buffer does return the correct number of chars with spaces. If I get a
char count on the lines with or without numbers it returns the correct number.
When I export to PDF the layout is the same as the print preview. When I test
with pdftotext then, as you say, it doesn't
OK, you got me on the PDF. I don't know about that. I think a monospace font
will help though because they are easier to keep track of rows and columns
since all the characters are in the same sized rectangle. The Marburg font is
also in a constant sized rectangle. I don't know how to put
Here is something else that might help. Try a monospace font to test with. If
you use a monospace font then your spacing should be kept correct. If I draw a
grid around the characters, monospace will hold the spacing to the 28x32 grid.
new_font = Pango.FontDescription("Monospace
I don't know the internals of how Pango deals with the different fonts for
putting them on a layout. I have bumped into utf8_casefold() and
utf8_normalize() before so I know fonts can get complicated. Maybe someone with
more knowledge than I have about this can help. The first
You have a print dialog and click on "Print to File" to save the contents to a
PDF file and that file is not being formatted correctly and isn't the same as
what is in the print preview?
I tried a small test program. It prints well to PDF with the extra lines. Does
There are a few things that you can try to see if you can get the combo box to
format how you want it. The first is to create the combo with
gtk_combo_box_new_with_model(). That way you can setup your cell renderer and
be able to set properties of how the combo box is going to be
With a treeview you can try measuring your rows and figure out where your
cursor is in your treeview. Try the following out and see if it is of any help.
With Ubuntu16.04 and GTK3.18.
gcc -Wall tree_row1.c -o tree_row1 `pkg-config --cflags --libs gtk+-3.0`
Could you use a GtkListBox? With a list box you can add a widget to the row and
connect the "enter-notify-event" and "leave-notify-event" signals. There is
example code for a list box at
It is drag and drop but you could
You can give the following a try and see if it helps. Basically you don't want
to bind up the "main" thread with a long running function and freeze your UI.
gcc -Wall firmware1.c -o firmware1 `pkg-config --cflags --libs gtk+-3.0`
Tested on Ubuntu16.04 and GTK3.18
A GtkAssistant or even a GtkNotebook might work for your program. What database
are you using? There is an easy example of connecting to and getting data from
that might be helpful. You
I would consider it a usability bug but not necessarily a textview widget bug.
If you add text, that doesn't have an indent tag, to the start of the line then
it doesn't get indented. I suppose you could check the whole line for an indent
tag but that would go against performance.
This isn't pretty but it works.
There is a good read about the spin button at
with Tim Bader on April 25, 2017. I don't know if you have seen that. My first
try was just to get the GdkWindow of the spin button but that gave me the main
Have you tried gtk_text_buffer_insert_with_tags_by_name() to insert text with a
tag at an iter?
What tag combo do you use to get the cursor to bounce around? If I test having
two indent tags on the same line, the first one applied wins out. This is what
I tested with.
I made a bit of a pointer mess there. Not the best of answers or way to go
about iterating through a list. Looking at some GTK code, this is better done
with a for loop. As usual, you don't want to move the pointer you get from
gtk_text_iter_get_tags() and then free it. This will
You can also try putting the pixbuf in an image widget and that into an event
//gcc -Wall right_click1.c -o right_click1 `pkg-config --cflags --libs gtk+-3.0`
static GdkPixbuf* draw_a_pixbuf()
The OpenCV window_gtk.cpp isn't so simple. A lot of tough concepts there. For
example the code is written for compiling with both GTK2 and GTK3, makes use of
threads, creates a custom GTK widget, uses GTK OpenGL if it can, etc.
The GTK functions can only be called on the "main"
It looks like both the plug and socket draw to the same window. That would mean
that you would have to draw your window background in both the plug and socket
"draw" callback functions. There is a plug2.c and socket2.c in the following
folder that sets the transparency on the different
If you set the socket color you will be OK. You won't have to worry about the
transparency of the plug, in that case.
For setting the transparency for the different windows you can try setting the
window, socket and plug widgets with the following. It worked on GTK3.18.
Add an extra column to your list and use that to set your "sensitive" property
for the row.
gcc -Wall combo_filter2.c -o combo_filter2 `pkg-config --cflags --libs
Tested on GTK3.18 and Ubuntu16.04
static void combo2_changed(GtkComboBox *combo2,
What part of the combo box are you trying to disable? If you want to filter
rows or columns you can set up a tree model filter to do so. Maybe something
like the following?
gcc -Wall combo_filter1.c -o combo_filter1 `pkg-config --cflags --libs
You might consider allowing the gauge to expand with the window size. This
makes the gauge a lot more flexible. When drawing a gauge it is useful to get a
general coordinate drawing on screen that you can check your gauge drawing
with. Both cartesian coordinates and radial
else g_print("No Tag\n");
From: Eric Cashon via gtk-app-devel-list <firstname.lastname@example.org>
To: dougm <do...@bravoecho.net>
Cc: gtk-app-devel-list <gtk-app-devel-list
Another option is to look at the properties of the tags to get the information
that you need. This might work better than saving globals and matching pointers.
Here are a few things that might improve the above code a little. Use
instead of a grab. Also the global gboolean can be eliminated if you pass the
toggle button pointer to the "insert-text" callback. Then you can just use
You can try using the "insert-text" callback to set your italics on the
inserted text. This is what I came up with to test. The signal is connected
after so that the update occurs first. Careful about not changing the location
iter also since there is a warning in the documentation
What version of GTK are you using?
It does work on my computer. The label expands and shrinks as the window
expands and shrinks and the label stops expanding at 012345678901234567... I
take that to be 20 chars if you start at 0 and include the three dots. The
tooltip shows the full string.
I am sure you can do that with GTK and GStreamer. That way the code would be
portable across platforms.
I don't have any examples of using GStreamer to get video from an ip camera. I
have some test code that will show the video from the local webcam.
Give the hexpand a try and see if that works. It works for me on Python3.5 and
gtk-app-devel-list mailing list
This doesn't use glade but it might help out. You can add a label and button to
a box and add it to the notebook tab. In the button "clicked" callback you can
us the notebook pointer if you need that variable. If you want to be able to
really customize the look and size of the
The trick here is to use gtk_tree_model_filter_convert_iter_to_child_iter().
That will get the iter that you need. It will work the same on both GTK2 and
GTK3. You have to be a little careful with gtk_tree_model_foreach(). It is easy
to add nodes and then the function will check
If I use
The background drawn to the event box window is transparent on my computer. I
just used "menu" to test a different color from the theme but there are many
that you can test. The style classes are at the bottom of the documentation
I gave it another try and "header" gtk_style_context_add_class() is
transparent. I can use "menu" and that returns a darker color that is used on
the title bar.
It is C again. I did get foo.vala output to foo.c. Too much stuff.
gcc -Wall box1.c -o box1 `pkg-config --cflags
is causing the problem. If you remove that, then you will have a box that you
place in the main window. If it is a header bar box it will be below the
titlebar. The box itself is just doing the layout so it uses the window behind
it. You can draw on the
The GtkBox is going to use the background window for it's color. The box just
does the layout. If you create a header bar from a box you will have to draw on
the background where your header bar is going to be. This can get a little
tricky to get the measurements that you need. A
I think what you are looking for is a C variadic function. Something that works
like g_object_set() with a Null terminated list of arguments.
Using dynamic glib containers might be a better choice. It is simpler to just
pass a single pointer with your user_data to functions which
Another thing to give a try is just to set a boolean in the "set-focus-child"
callback. Not sure if this will always work. I think that it should.
I don't know the best workaround for the "focus-in-event" in a combo box. It
isn't obvious how to connect that signal for the combobox.
The "set-focus-child" on the container fires for the "focus-in-event" and
"focus-out-event". I forgot about those container functions though. You can get
the toggle button pointer from the container and set up your "focus-in-event".
That way there is no ugly business of using a
Your original question looked easy. Connect the "focus-in-event" to the combo
box and everything will work fine. The "focus-in-event" works with other
widgets. So I tried it out. Couldn't get it to work. Tried changing some combo
box functions around and still couldn't get it to work.
You can try getting the private toggle button in the combo box. This isn't a
solution using the given GTK api but if you want to inspect the how to get the
"focus-in-event" to work with a combo box, this might be helpful. You are
working in C right?
Not sure about this one. I tested some code out to see if I could figure it
out. Had the same problem that you had with the "changed" signal not being
blocked. If I change the rate of the file monitor and try to spool out the
events, I can block the "changed" signal. Not something
One approach is to use a GtkOverlay. Draw the shape on the top and then save
the coordinates of the shape if it is what you want. Then you can draw the
saved shapes on the lower drawing area.
Some follow up on this. If you are starting a separate process to run your
transcoding you need to use an async version of your run_cmd(). Otherwise the
program will wait until the function returns and bind up the main glib thread
if the function takes a while. This might be the easiest way
Try getting the font height and base the textview height on that. If you use
the font ascent you might have to pad it a little but it should give you a
consistent value to size your textviews with based on font size.
gcc -Wall textview_height1.c -o textview_height1
The layout is similar to a drawing area. Set up your "draw" callback and draw
what you like. You can put your pictures in there also and be able to scroll
gcc -Wall layout1.c -o layout1 `pkg-config --cflags --libs gtk+-3.0`
Tested on Ubuntu16.04 and GTK3.18
Have you looked at using a thread pool?
If you have a folder full of files that you want to transcode you can set up
your thread pool to cycle through them.
Consider using a drawing area and GTK3. There are more drawing and graphical
capabilities in GTK3. Going forward to GTK4 I expect even more drawing
capabilities since every computer sold these days has a gpu and the software
can take advantage of that.
With a drawing area you get
If the default progress bar in GTK isn't what you are looking for then you can
always make your own. You can design it how you want easy enough with a drawing
area. With GTK3 you have OpenGL, Cairo, gradients, tensor-product patch meshes,
etc. to draw with. You even have a frame clock for
Give this a try. It might be close to what you are after.
from gi.repository import Gtk, Gdk
Gtk.Window.__init__(self, title="Menu Popup")
I tried out gtkedit and it compiled and worked fine. Did a few searches and
it found the words.
When I compiled I got a few warnings like the following.
gtk_common_dlg.c: In function ‘err_dialog’:
gtk_common_dlg.c:8:9: warning: format not a string literal and no format
I asked a question about this on the gtk-devel-list
last month. A lot I didn't know about this. For UTF-8 it is a bit complicated
even for English. For GTK's case in-sensitive search they use a casefold
For this you need the private data of the entry completion to get it to work.
That means looking around the GTK source and seeing how you might put something
together. Of course, it is not recommended to use something that can be changed
at anytime by the GTK developers. So... I gave
I didn't get to the paper size setup there. Just tried to make sense out of
getting text to print on multiple pages as simply as possible. I don't have a
printer that I can test with either so I am no help there.
Printing is difficult. You can draw easy enough on a drawing area but then
I hit the reply instead of reply all on the first send. Try again.
There is some information about printing at
It is in C++ but the C++ tutorial is very good. Sometimes I go there to figure
out how to
I worked on this a little more and tried to make it UTF-8 compliant.
Highlighted the text also. It should still be efficient since it is only doing
a single pass over each char. I am sure there are things that I haven't
considered but it does a little more than the first try at it.
I put together a test example of GSubprocess. It starts Gnuplot, sets up the
pipes and callbacks, and then when Gnuplot is done it opens the graph in an
image widget. The GSubprocess will take care of the file descripters for you.
Also, if I run valgrind with multiple plots being
In GTK3 you would have everything that you need. The
gtk_text_iter_forward_search() function can use
GTK_TEXT_SEARCH_CASE_INSENSITIVE. I don't see that in GTK2.
Another thought. The GTK Source View can find words and highlight them for you.
You might want to check that out also. It has some
1 - 100 of 107 matches
Mail list logo