Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Using <code>gtk.ScrolledWindow.set_shadow_type(type=gtk.SHADOW_ETCHED_IN)</code> will improve the look but won't match the style of <code>gtk.Entry</code>.</p> <p>The border of the scolled window or textview is not an issue if placed in a window or pane, but if the goal is to create a form with a multi-line entry field it becomes ugly. Here is a hack that may do the trick...</p> <pre class="lang-python prettyprint-override"><code>import gtk # create an entry widget that we use for appearances only e=gtk.Entry() e.set_size_request(width=250, height=150) # create a texview and accompaying label lbl = gtk.Label(str="Comments: ") lbl.set_alignment(xalign=1, yalign=0) field = gtk.TextView(buffer=None) field.set_wrap_mode(wrap_mode=gtk.WRAP_WORD) # or gtk.WRAP_CHAR # we need a scroll window sw = gtk.ScrolledWindow(hadjustment=None, vadjustment=None) sw.set_border_width(border_width=4) sw.set_size_request(width=250, height=150) sw.set_policy(hscrollbar_policy=gtk.POLICY_NEVER, vscrollbar_policy=gtk.POLICY_AUTOMATIC) sw.add(field) # create more widgets as needed for form here... lbl2 = gtk.Label(str="email: ") lbl2.set_alignment(xalign=1, yalign=0) field2 = gtk.Entry() # put everything in a table so the fields and labels are all aligned tbl = gtk.Table(rows=1, columns=2, homogeneous=False) tbl.attach(lbl, left_attach=0, right_attach=1, top_attach=0, bottom_attach=1, xoptions=gtk.FILL|gtk.SHRINK, yoptions=gtk.FILL, xpadding=0, ypadding=0) # sw and e must be attached in this order, the reverse will not work tbl.attach(sw, left_attach=1, right_attach=2, top_attach=0, bottom_attach=1, xoptions=gtk.FILL|gtk.SHRINK, yoptions=gtk.FILL, xpadding=0, ypadding=0) tbl.attach(e, left_attach=1, right_attach=2, top_attach=0, bottom_attach=1, xoptions=gtk.FILL|gtk.SHRINK, yoptions=gtk.FILL, xpadding=0, ypadding=0) # comment out previous line to see difference # attach other widgets here... tbl.attach(lbl2, left_attach=0, right_attach=1, top_attach=1, bottom_attach=2, xoptions=gtk.FILL|gtk.SHRINK, yoptions=gtk.FILL, xpadding=0, ypadding=0) tbl.attach(field2, left_attach=1, right_attach=2, top_attach=1, bottom_attach=2, xoptions=gtk.FILL|gtk.SHRINK, yoptions=gtk.FILL, xpadding=0, ypadding=0) # display it! window = gtk.Window() window.set_default_size(350, 200) window.connect("destroy", lambda w: gtk.main_quit()) window.add(tbl) window.show_all() gtk.main() </code></pre> <p>The caveat is that the scrollbar(s) becomes invisible; it can be selected, and scrolling works as usual. This may be a minor issue if the data to be entered in the field tends to not make use of scrolling.</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. 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