Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Here's a screenshot of the window that your code creates:</p> <p><img src="https://i.stack.imgur.com/nOonq.png" alt="Screenshot of window"></p> <p>I imagine that you were expecting to see a square. However, all that you get to see is the top left of that square. This is because the drawing area has requested a very small amount of space, resulting in a small window. This means that your wonderful artwork is being clipped to fit in a window of this minimal size. There are a couple of things you could do:</p> <ol> <li><p>Set the minimum size of the scrolled window that contains the drawing area:</p> <pre><code>gtk_widget_set_size_request( swindow, 500, 500 ); </code></pre> <p>This will result in a 500 by 500 pixel drawing area being visible (which is lots more than you need for the square). However, if you make the window larger, then the drawing area will not fill it.</p></li> <li><p>Set the scrolled window to take on all horizontal and vertical space it can get:</p> <pre><code>gtk_widget_set_hexpand( swindow, TRUE ); gtk_widget_set_vexpand( swindow, TRUE ); </code></pre> <p>If you just do this, then the window will initially look the same as the one in your original code. However, if you manually resize the window, then you'll see that the scrolled window (and hence the drawing area) expands to fill all of the space it can in the window. If you expand it enough, you'll see your square.</p></li> </ol> <p>If you combine both of the above, then you'll get a window that's initially ~500x500 pixels. If you resize it, then the drawing area will expand to fill the window.</p> <p>You could also add a <code>gtk_widget_set_size_request</code> call to set the size of the drawing area widget. If you set it to be larger than the scrolled window's size, then you'll get scrollbars.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload