Results 1 to 7 of 7

Thread: PyGTK Glade TreeView / ListView

  1. #1
    Join Date
    Apr 2011
    Location
    Slovenia
    Beans
    83
    Distro
    Ubuntu 12.10 Quantal Quetzal

    Question PyGTK Glade TreeView / ListView

    I'm making some app with Quickly, which means I'm using Glade for the UI and Python for programming. I've inserted a TreeView with 2 columns in Glade, and now I'm stuck with adding rows to it.

    How is that being done in Python?

    The row cells must be empty and when clicked you can input text into those.
    Attached Images Attached Images

  2. #2
    Join Date
    Apr 2011
    Location
    Slovenia
    Beans
    83
    Distro
    Ubuntu 12.10 Quantal Quetzal

    Re: PyGTK Glade TreeView / ListView

    I've been experimenting around a bit and found out that if I do this

    Code:
    listview.append(row=None)
    and add it to a button's click function, when I click it a thin "row" appears but with no content relating to the row=None I guess.
    If I click it for multiple times, more and more "rows" begin to show up. But still, I can't do much with those.

    Does listview actually handle the rows and treeview is only kind of a housing for the listview?

  3. #3
    Join Date
    Jan 2006
    Beans
    Hidden!
    Distro
    Ubuntu 10.10 Maverick Meerkat

    Re: PyGTK Glade TreeView / ListView

    Treeview is very general and depends on the datastore you use. I wrote a Perl version long time ago, but the usage should be similar. Try searching for the treeview I wrote ... should be somewhere in these forums.
    I am infallible, you should know that by now.
    "My favorite language is call STAR. It's extremely concise. It has exactly one verb '*', which does exactly what I want at the moment." --Larry Wall
    (02:15:31 PM) ***TimToady and snake oil go way back...
    42 lines of Perl - SHI - Home Site

  4. #4
    Join Date
    Apr 2011
    Location
    Slovenia
    Beans
    83
    Distro
    Ubuntu 12.10 Quantal Quetzal

    Re: PyGTK Glade TreeView / ListView

    I've found out how to do it, following some guide.

    Code:
    # Create the store object
    self.store = self.builder.get_object("liststore1")
    # Put stuff into the store
    self.store.append(['1st column','2nd column'])
    # ^ This is an example for a 2 column list store
    This works now like it seems.

    But now I've got a new problem / question.

    I've created a button called "saveButton". I want the button to run a function after clicked. As I'm doing this with Python and PyGTK I first tell the app who that save button is by doing this:

    Code:
    self.saveButton = self.builder.get_object("saveButton")
    Then:
    Code:
    def on_saveButton_clicked():
             self.store.append(['123','abc'])
    This should actually do something when being clicked but it doesn't.
    Attached Images Attached Images
    Last edited by snowz; August 9th, 2012 at 08:04 PM.

  5. #5
    Join Date
    Apr 2011
    Location
    Slovenia
    Beans
    83
    Distro
    Ubuntu 12.10 Quantal Quetzal

    Re: PyGTK Glade TreeView / ListView

    Ok, stuff just got weird.

    Code:
    def on_saveButton_clicked():
            print 'Clicked'
    It doesn't even print 'Clicked'.

  6. #6
    Join Date
    Jun 2009
    Location
    SW Forida
    Beans
    Hidden!
    Distro
    Ubuntu 16.04 Xenial Xerus

    Re: PyGTK Glade TreeView / ListView

    You need to connect the signals:

    # connect signals
    self.builder.connect_signals(self)

    I have been trying pyqt, so I have not looked at these links for a while.
    The Python GTK+ 3 Tutorial
    http://python-gtk-3-tutorial.readthe...est/index.html
    treeview info (older)
    http://scentric.net/tutorial/
    builder
    http://www.micahcarrick.com/12-24-20...al-part-1.html
    builder definitions
    http://www.pygtk.org/docs/pygtk/class-gtkbuilder.html
    py faqs builder
    http://faq.pygtk.org/index.py?req=sh...=faq13.039.htp
    For more info on UEFI boot install & repair - Regularly Updated :
    http://ubuntuforums.org/showthread.php?t=2147295
    Please use Thread Tools above first post to change to [Solved] when/if answered completely.

  7. #7
    Join Date
    Apr 2011
    Location
    Slovenia
    Beans
    83
    Distro
    Ubuntu 12.10 Quantal Quetzal

    Re: PyGTK Glade TreeView / ListView

    Ah damned. I had the on_button_clicked() function inside of the initialisation function, that's why it didn't work.

    Thread SOLVED.

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •