Sponsored Content
Top Forums Shell Programming and Scripting Python/GTK Text Wrap Question . . . Post 302949266 by LinQ on Wednesday 8th of July 2015 02:05:05 PM
Old 07-08-2015
Python/GTK Text Wrap Question . . .

Greetings!

After some cut-and-try, I've cobbled together the following bit of basic code:
Code:
#!/usr/bin/python

import gtk

class PyApp(gtk.Window): 
    def __init__(self):
        super(PyApp, self).__init__()
        
        self.set_size_request(250, 250)
        self.set_position(gtk.WIN_POS_CENTER)
        self.connect("destroy", gtk.main_quit)
        self.set_title("Custom Message Box Test")
        self.label = gtk.Label()
        self.label.set_label("This is the sample text content; and it goes on and on and on...")
        self.label.set_line_wrap(True)

        button = gtk.Button("OK")
        button.connect("clicked", self.on_clicked)

        fixed = gtk.Fixed()
        fixed.put(button, 200, 200)
        fixed.put(self.label, 5, 5)

        self.add(fixed)
        self.show_all()

    def on_clicked(self, widget):
        self.destroy()

PyApp()
gtk.main()

...but try as I might, I just can't get
Code:
self.label.set_line_wrap(True)

to tick over in this context Smilie

Any ideas as to how this could work?

Thanks a bunch!
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

how to open a text file by double clicking on the file name in gtk+

how to open a text file by double clicking on the file name shown in a label widget in gtk+. thanks (0 Replies)
Discussion started by: cy163
0 Replies

2. UNIX for Dummies Questions & Answers

how to open a text file using some tool such as gedit under gtk

how to open a text file using some tool such as gedit under gtk I list some text file names in a GtkCList . I want to open the file on when users click on the row. How to implement this ? Thanks (0 Replies)
Discussion started by: cy163
0 Replies

3. Shell Programming and Scripting

usage of module Text::Wrap;

hi, i want to use module Text::Wrap. this module provides the option $Text::Wrap::tabstop to change the tabstop from 8 blanks to any nummer. i want to set it to 30 blanks. but when i change the nummer of blanks nothing happens. Text::Wrap::tabstop = 30; $wtd = wrap("","\t",$1); or do i... (3 Replies)
Discussion started by: trek
3 Replies

4. UNIX for Dummies Questions & Answers

Sendmail - Disable text wrap

Hi, I am using sendmail to trigger mail alerts. The body of the mail is becoming wrapped in to fit to mail window. I want body to be not wrapped like ' set nowrap 'as in vi editor. ---------- Post updated at 05:35 AM ---------- Previous update was at 04:48 AM ---------- a text of 1000... (1 Reply)
Discussion started by: subramanian2008
1 Replies

5. Programming

GTK C development; question/concern wrt gtk_dialog_run

I'm new to GTK development, so I've been going through the examples just to capture the basics. I've done a lot of Unix GUI development before, but it was all Xt/Motif stuff. So, the GTK scheduler is something new to me. That said, I was going through the color selection example here, and was... (8 Replies)
Discussion started by: DreamWarrior
8 Replies

6. UNIX for Dummies Questions & Answers

Capslock and Python Question

Hello All, I was looking for a solution for enabling/disabling the Capslock from the command line and came across some Python code for doing just that... Well, in this case the code was written to ONLY turn-off Capslock but I assume there has to be a way to turn it on too. Site where I... (0 Replies)
Discussion started by: mrm5102
0 Replies

7. Shell Programming and Scripting

Python question

#!/usr/bin/python def genCommanString(s): print s abc = { "sftp":genCommanString('f5sftp'), "/usr/local/ssh/bin/sftp": genCommanString('f5sftp') } value="sftp" xyz = abc.get(value) Why the above coding produce 2 row output? (i.e. f5sftp f5sftp) Is it... (1 Reply)
Discussion started by: cstsang
1 Replies

8. Shell Programming and Scripting

Question about Strings in Python

Hi, I get he values for nmval=MS1 & csval=Cluster from the properties file like below. nmval=configProps.get("SVR_NAME") csval=configProps.get("CLS_NAME")What should i do in the commands below so as to use the variables nmval and csval instead of manually typing MS1 and Cluster I want to... (1 Reply)
Discussion started by: mohtashims
1 Replies

9. Programming

A straightforward Python question.

Hi all... Simple yes or no answer question for the big guns with a qualifier if YES. I can possibly do FFT for my needs in AudioScope using python. Q: Is python now considered part of the /usr/bin or other command paths for ALL current *NIX style OSes? IF YES which version(s) should I... (4 Replies)
Discussion started by: wisecracker
4 Replies

10. Programming

Python p.ravel question

Hi, I'm trying to decipher some python code located here: Minimal character-level language model with a Vanilla Recurrent Neural Network, in Python/numpy * GitHub I'm unable to understand what line 75 is doing? ix = np.random.choice(range(vocab_size), p=p.ravel()) Anyone know what this... (2 Replies)
Discussion started by: 1Brajesh
2 Replies
Gtk2::ToolButton(3pm)					User Contributed Perl Documentation				     Gtk2::ToolButton(3pm)

NAME
Gtk2::ToolButton - wrapper for GtkToolButton HIERARCHY
Glib::Object +----Glib::InitiallyUnowned +----Gtk2::Object +----Gtk2::Widget +----Gtk2::Container +----Gtk2::Bin +----Gtk2::ToolItem +----Gtk2::ToolButton INTERFACES
Glib::Object::_Unregistered::AtkImplementorIface Gtk2::Buildable Gtk2::Activatable METHODS
toolitem = Gtk2::ToolButton->new ($icon_widget, $label) o $icon_widget (Gtk2::Widget or undef) o $label (string or undef) toolitem = Gtk2::ToolButton->new_from_stock ($stock_id) o $stock_id (string) string or undef = $button->get_icon_name Since: gtk+ 2.8 $button->set_icon_name ($icon_name) o $icon_name (string or undef) Since: gtk+ 2.8 widget or undef = $button->get_icon_widget $button->set_icon_widget ($icon_widget) o $icon_widget (Gtk2::Widget or undef) string or undef = $button->get_label $button->set_label ($label) o $label (string or undef) widget or undef = $button->get_label_widget $button->set_label_widget ($label_widget) o $label_widget (Gtk2::Widget or undef) string = $button->get_stock_id $button->set_stock_id ($stock_id) o $stock_id (string or undef) boolean = $button->get_use_underline $button->set_use_underline ($use_underline) o $use_underline (boolean) PROPERTIES
'icon-name' (string : default undef : readable / writable / private) The name of the themed icon displayed on the item 'icon-widget' (Gtk2::Widget : default undef : readable / writable / private) Icon widget to display in the item 'label' (string : default undef : readable / writable / private) Text to show in the item. 'label-widget' (Gtk2::Widget : default undef : readable / writable / private) Widget to use as the item label 'stock-id' (string : default undef : readable / writable / private) The stock icon displayed on the item 'use-underline' (boolean : default false : readable / writable / private) If set, an underline in the label property indicates that the next character should be used for the mnemonic accelerator key in the overflow menu STYLE PROPERTIES
'icon-spacing' (integer : default 3 : readable / writable / private) Spacing in pixels between the icon and label SIGNALS
clicked (Gtk2::ToolButton) SEE ALSO
Gtk2, Glib::Object, Glib::InitiallyUnowned, Gtk2::Object, Gtk2::Widget, Gtk2::Container, Gtk2::Bin, Gtk2::ToolItem COPYRIGHT
Copyright (C) 2003-2011 by the gtk2-perl team. This software is licensed under the LGPL. See Gtk2 for a full notice. perl v5.14.2 2012-05-27 Gtk2::ToolButton(3pm)
All times are GMT -4. The time now is 02:38 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy