Why can't I define the size of a Gtk.Entry embedded in a Gtk.Toolbar?

7,815

I don't think it's a problem specific to the toolbar, in that if you add an entry elsewhere you would face the same issue - it won't go less than a certain width (I'm assuming your problem is making it smaller rather than larger) using the Width request property.

See this: http://faq.pygtk.org/index.py?file=faq14.001.htp&req=show and http://developer.gnome.org/gtk3/3.2/GtkEntry.html#gtk-entry-set-width-chars

That is, set the property Width in chars (if using glade) or simply:

# widget refers to the GtkEntry object
widget.set_width_chars(5)

Of course, that will be ignored if you have a Width request greater than Width in chars.

Share:
7,815
Phoenix87
Author by

Phoenix87

PhD in Pure Mathematics, University of Glasgow. My research area was Functional Analysis. Specifically, I worked on the problem of the classification of C*-algebras (arXiv:1602.02043, arXiv:1607.02333). During my MSc in Theoretical Physics, I focused on Algebraic Quantum Field Theory and contributed to DFR models for Quantum Space-time (arXiv:1211.7050). I currently work as a Software Engineer in Edinburgh, Scotland, on an Oracle Database application, specifically on the innovation and maintenance of the messaging system and interface. I work with many technologies, including PL/SQL, Java, shell scripting. I also work on side projects, mostly in Python, and some of them in the area of Machine Learning. I maintain Austin, a Python frame stack sampler for CPython that can be used to make Python statistical profilers. If you want to give it a go, you can find it on GitHub at https://github.com/P403n1x87/austin

Updated on September 18, 2022

Comments

  • Phoenix87
    Phoenix87 over 1 year

    I have embedded a Gtk.Entry box into a Gtk.Toolbar, however changing the requested width of practically anything (i.e. the Gtk.ToolItem that contains the Gtk.Entry and the Gtk.Entry itself) doesn't change the size of the Gtk.Entry. What is that I'm doing wrong?

  • Phoenix87
    Phoenix87 almost 12 years
    Exactly the answer I was looking for. Thank you very much!