[pygtk] yet another gtk.Notebook question
After having solved my first problem, I now have another one: When I retrieve a drag-drop event, I would like to know, which notebook tab was dropped. In the C API, the example looks like this: static void on_drop_zone_drag_data_received (GtkWidget*widget, GdkDragContext *context, gint x, gint y, GtkSelectionData *selection_data, guint info, guint time, gpointer user_data) { GtkWidget *notebook; GtkWidget **child; notebook = gtk_drag_get_source_widget (context); child = (void*) selection_data->data; process_widget (*child); gtk_container_remove (GTK_CONTAINER (notebook), *child); } However, the pygtk equivalent only accepts the arguments context, x, y, time. How can I get the child widget as shown above? ___ pygtk mailing list pygtk@daa.com.au http://www.daa.com.au/mailman/listinfo/pygtk Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/
Re: [pygtk] gtk.Notebook dnd to other widgets [SOLVED]
Gian Mario Tagliaretti schrieb: > 2007/5/6, N. Volbers <[EMAIL PROTECTED]>: > >> I found the problem! The documentation is wrong. If you look at the >> original API documentation of gtk+, it will say that the target is >> "GTK_NOTEBOOK_TAB" and not (like it says in the pygtk documentation) >> "gtk.NOTEBOOK_TAB". > > gtk.NOTEBOOK_TAB is the python equivalent of the C's GTK_NOTEBOOK_TAB, > it should not even work if you use the latter. > > cheers The target is a string, not a constant, i.e. the target is something like ("GTK_NOTEBOOK_TAB", ... ) Actually, there is not even a gtk.NOTEBOOK_TAB. Using the above string works fine. Niklas. ___ pygtk mailing list pygtk@daa.com.au http://www.daa.com.au/mailman/listinfo/pygtk Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/
Re: [pygtk] gtk.Notebook dnd to other widgets [SOLVED]
Niklas Volbers schrieb: > Hi everyone! > > I am using the reorderable and detachable properties of gtk.Notebook tabs > (pygtk 2.10). > > Now I wanted to implement dragging a notebook tab to an event box, but > somehow my event box will not respond to the dnd event from the notebook tab. > I am not sure if I set up the target properly and I could not find any > example on the net. > > The attached example illustrates my problem. > > Best regards, > > Niklas. > > ___ > SMS schreiben mit WEB.DE FreeMail - einfach, schnell und > kostenguenstig. Jetzt gleich testen! http://f.web.de/?mc=021192 > > > > > > ___ > pygtk mailing list pygtk@daa.com.au > http://www.daa.com.au/mailman/listinfo/pygtk > Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/ I found the problem! The documentation is wrong. If you look at the original API documentation of gtk+, it will say that the target is "GTK_NOTEBOOK_TAB" and not (like it says in the pygtk documentation) "gtk.NOTEBOOK_TAB". Should I file a bug report or is this mail sufficient? Best regards, Niklas. ___ pygtk mailing list pygtk@daa.com.au http://www.daa.com.au/mailman/listinfo/pygtk Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/
Re: [pygtk] Close button in notebook tab
Sylvain Saleur schrieb: > Hi! > > I managed to create a custom tab with a close button. My problem is that > when I click on a non-focused tab's close button, it close the focused > tab... > > Do you have any suggestion? > > I look forward to hearing from you. > > Bests. > > Sylvain Saleur > > Code: (sorry, the comments are in french... The code come from this > post: http://www.daa.com.au/pipermail/pygtk/2006-April/012216.html ) > > #!/usr/bin/env python > # -*- coding:utf-8 -*- > > # notebook.py > > import pygtk > pygtk.require('2.0') > import gtk > > class NotebookExample: >def add_icon_to_button(self,button): >"Fonction pour ajouter un bouton fermer" >#création d'une boite horizontale >iconBox = gtk.HBox(False, 0) #Création d'une image vide >image = gtk.Image() >#On récupère l'icone du bouton "fermer" >image.set_from_stock(gtk.STOCK_CLOSE,gtk.ICON_SIZE_MENU) >#On enlève le relief au bouton (donné en attribut) >gtk.Button.set_relief(button,gtk.RELIEF_NONE) >#On récupère les propriétés du bouton >settings = gtk.Widget.get_settings(button) >#On affecte à w et h les dimensions >(w,h) = > gtk.icon_size_lookup_for_settings(settings,gtk.ICON_SIZE_MENU) >#On modifie ces dimensions >gtk.Widget.set_size_request(button, w + 4, h + 4) >image.show() >#On met l'image dans la boite >iconBox.pack_start(image, True, False, 0) >#On ajoute la boite dans le bouton >button.add(iconBox) >iconBox.show() >return >def create_custom_tab(self,text, notebook): >"Crée une tab customisée avec un label et un bouton fermer" >#On crée une eventbox >eventBox = gtk.EventBox() >#On crée une boite horizontale >tabBox = gtk.HBox(False, 2) >#On crée un label "text" (text donné en attribut) >tabLabel = gtk.Label(text) >#On crée un bouton >tabButton=gtk.Button() >#On lui affecte la méthode remove_book >tabButton.connect('clicked',self.remove_book, notebook) > >#On ajoute l'image au bouton en utilisant la méthode > add_icon_to_button >self.add_icon_to_button(tabButton) > eventBox.show() >tabButton.show() >tabLabel.show() >#On attache label et bouton à la boite >tabBox.pack_start(tabLabel, False) > tabBox.pack_start(tabButton, False) > >tabBox.show_all() >#On ajoute la boite à l'eventbox >eventBox.add(tabBox) >return eventBox > def remove_book(self, button, notebook): >"Fonction de suppression de page" >#On récupère la page courante >page = notebook.get_current_page() >#On la supprime >notebook.remove_page(page) ># On actualise le widget >notebook.queue_draw_area(0,0,-1,-1) > >def delete(self, widget, event=None): >gtk.main_quit() >return False > >def __init__(self): >window = gtk.Window(gtk.WINDOW_TOPLEVEL) >window.connect("delete_event", self.delete) >window.set_border_width(10) > >#On crée un nouveau notebook >notebook = gtk.Notebook() >window.add(notebook) >notebook.show() > ># On ajoute quelques pages >for i in range(5): >page_number = i + 1 >frame = gtk.Frame("Frame %d" % page_number) >frame.set_border_width(10) >frame.set_size_request(100, 75) >frame.show() >label = gtk.Label("Dans la Frame %d" % page_number) >frame.add(label) >label.show() > eventBox = self.create_custom_tab("Tab %d" % > page_number, notebook) >notebook.append_page(frame, eventBox) ># Page que nous verrons à l'ouverture (page 4) >notebook.set_current_page(3) >window.show() > > def main(): >gtk.main() >return 0 > > if __name__ == "__main__": >NotebookExample() >main() > ___ > pygtk mailing list pygtk@daa.com.au > http://www.daa.com.au/mailman/listinfo/pygtk > Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/ > You can use notebook.remove(widget) to remove the proper notebook tab. Of course, then the callback needs to know, which widget it should remove. I suggest passing the frame to the create_custom_tab method: eventBox = self.create_custom_tab("Tab %d" % page_number, notebook, frame) Then, in create_custom_tab, you add the frame to the connect method: tabButton.connect('clicked',self.remove_book, notebook, frame) And finally, in the remove_book method, you know exactly which tab to remove: notebook.remove_page(frame) ___ pygtk mailing list pygtk@daa.com.au http://www.daa.com.au/mailman/listinfo/pygtk Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/
Re: [pygtk] adding a close button to a notebook
Tony Nelson schrieb: At 8:36 AM +0200 10/20/06, N. Volbers wrote: Hello everyone, I am using a notebook for a sort of tabbed interface a la Firefox. Currently, there is a close button for each tab, positioned in the tab widget. However, I would like to have just a single close button at the very right of the notebook (again, just like Firefox does). Is there a way to add a widget inside the notebook tab box? I use something like this: class NotebookTabLabel(gtk.HBox): '''Notebook tab label with close button. ''' def __init__(self, on_close, owner_): gtk.HBox.__init__(self, False, 0) label = self.label = gtk.Label() label.set_alignment(0.0, 0.5) self.pack_start(label) label.show() close_image = gtk.image_new_from_stock(gtk.STOCK_CLOSE, gtk.ICON_SIZE_MENU) image_w, image_h = gtk.icon_size_lookup(gtk.ICON_SIZE_MENU) close_btn = gtk.Button() close_btn.set_relief(gtk.RELIEF_NONE) close_btn.connect('clicked', on_close, owner_) close_btn.set_size_request(image_w+2, image_h+2) close_btn.add(close_image) self.pack_start(close_btn, False, False) close_btn.show_all() self.show() tl = NotebookTabLabel( lambda *args: self.owner.on_tab_close_doc(*args), self ) I hacked this down from something fancier, but I think it's still all there. Thanks for your reply! The example you provide is very useful, even though it is not exactly what I had in mind. I was looking for a single close button that belongs to the notebook, and not a button for each tab. Yet your solution works well for me, so unless someone suggests something different, I will use your approach. Best regards, Niklas. ___ pygtk mailing list pygtk@daa.com.au http://www.daa.com.au/mailman/listinfo/pygtk Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/
[pygtk] adding a close button to a notebook
Hello everyone, I am using a notebook for a sort of tabbed interface a la Firefox. Currently, there is a close button for each tab, positioned in the tab widget. However, I would like to have just a single close button at the very right of the notebook (again, just like Firefox does). Is there a way to add a widget inside the notebook tab box? Best regards, Niklas. ___ pygtk mailing list pygtk@daa.com.au http://www.daa.com.au/mailman/listinfo/pygtk Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/
Re: [pygtk] passing data to actions invoked by popup
Nikos Kouremenos wrote: On 4/1/06, N. Volbers <[EMAIL PROTECTED]> wrote: Hello Nikos, Nikos Kouremenos wrote: menu.popup() normally accepts additonal data. but PyGTK devs wrapped it bad so in PyGTK world it doesn't. I have reported this in BT. your ugly solution is what I also do. well not global but class variable which is the same 'bad' I filed a bug report. gimme link, as it's dup of mine which has status "no one is working on it, please patch us" and this is not 1st april joke (that already exists one) -- Nikos Kouremenos Bug #336804 Hmmm, I had searched for a similar existing bug before submission, but I must have missed it! Too bad. So please mark it as duplicate of yours. Niklas. ___ pygtk mailing list pygtk@daa.com.au http://www.daa.com.au/mailman/listinfo/pygtk Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/
Re: [pygtk] passing data to actions invoked by popup
Hello Nikos, Nikos Kouremenos wrote: menu.popup() normally accepts additonal data. but PyGTK devs wrapped it bad so in PyGTK world it doesn't. I have reported this in BT. your ugly solution is what I also do. well not global but class variable which is the same 'bad' I filed a bug report. Niklas Volbers. ___ pygtk mailing list pygtk@daa.com.au http://www.daa.com.au/mailman/listinfo/pygtk Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/
[pygtk] passing data to actions invoked by popup
Hello everyone, in my applications I have different tool widgets, very similar to the dockable tools in gimp, and they all have a button at the top-right that opens up a popup menu when pressed. This popup allows to add other tools, so for this reason, the popup is always the same. Unfortunately, this means that since every popup is the same, the corresponding actions are always the same as well. There seems to be no way to know from which tool instance the popup was called. So my question is: Is there any way to add certain extra information when popping up a menu, so that when an action is triggered, this extra information is passed on to the callback ? My current solution is rather ugly: Before calling menu.popup, I set a global variable to hold this extra information, so that the callback can retrieve it. Niklas Volbers. ___ pygtk mailing list pygtk@daa.com.au http://www.daa.com.au/mailman/listinfo/pygtk Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/
[pygtk] two treeview problems, this time with attachment
Hello everyone on the list, I have two questions regarding the treeview widget: (1) (see attached sample script) Using a CellRendererCombo it is possible to manipulate the model data by choosing a value from the combo. Clicking on 'apply' in the sample script will dump the values in the model to stdout. My problem occurs, if you try to modify a value by selecting a value in the combo, and then you immediately click on apply without leaving the combo. In this case the 'edited' signal of the treeview is not emitted and the selected value in the combo is not set in the model! However, at least for myself I would prefer this kind of behaviour. Is there any way to force the treeview to finish any pending edit operations? (2) For some columns, I would like to have a button appear if you enter the row, e.g. a little button with three dots indicating that if you click on the button you will get a fancy dialog. I guess it would be possible to write such a thing using a GenericCellRenderer, but I would be very happy if anybody could point out existing code to me? With best regards, Niklas Volbers. import gtk model = gtk.ListStore(str) for i in range(4): model.append((str(i),)) cell_model = gtk.ListStore(str) for i in range(10): cell_model.append((str(i),)) treeview = gtk.TreeView(model) cell = gtk.CellRendererCombo() cell.set_property('text-column',0) cell.set_property('model', cell_model) def on_edited(cell,path,new_text,model,index): model[path][index]=new_text cell.connect('edited', on_edited, model, 0) cell.set_property('editable', True) column = gtk.TreeViewColumn('a',cell) column.set_attributes(cell, text=0) treeview.append_column(column) button = gtk.Button(stock=gtk.STOCK_APPLY) def on_clicked(sender):# print "model values: " iter = model.get_iter_first() while iter is not None: print " %s" % model[iter][0] iter = model.iter_next(iter) button.connect('clicked', on_clicked) vbox = gtk.VBox() vbox.pack_start(treeview,True,True) vbox.pack_start(button,False,True) win = gtk.Window() win.connect("destroy", gtk.main_quit) win.add(vbox) win.set_size_request(480,320) win.show_all() gtk.main() ___ pygtk mailing list pygtk@daa.com.au http://www.daa.com.au/mailman/listinfo/pygtk Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/
[pygtk] two treeview problems
Hello everyone on the list, I have two questions regarding the treeview widget: (1) (see attached sample script) Using a CellRendererCombo it is possible to manipulate the model data by choosing a value from the combo. Clicking on 'apply' in the sample script will dump the values in the model to stdout. My problem occurs, if you try to modify a value by selecting a value in the combo, and then you immediately click on apply without leaving the combo. In this case the 'edited' signal of the treeview is not emitted and the selected value in the combo is not set in the model! However, at least for myself I would prefer this kind of behaviour. Is there any way to force the treeview to finish any pending edit operations? (2) For some columns, I would like to have a button appear if you enter the row, e.g. a little button with three dots indicating that if you click on the button you will get a fancy dialog. I guess it would be possible to write such a thing using a GenericCellRenderer, but I would be very happy if anybody could point out existing code to me? With best regards, Niklas Volbers. ___ pygtk mailing list pygtk@daa.com.au http://www.daa.com.au/mailman/listinfo/pygtk Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/
[pygtk] ruler widget deprecated?
Hello everyone, I intended to add rulers to my matplotlib canvas widget, but then I have read in the reference that the ruler widget (and hruler, vruler) is deprecated and will be moved to another package. To which package? Should I use it at all or is there an alternative implementation? Regards, Niklas. ___ pygtk mailing list pygtk@daa.com.au http://www.daa.com.au/mailman/listinfo/pygtk Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/
Re: [pygtk] SpinButton and a value of None
Graham Ashton schrieb: On Thursday 24 November, N. Volbers wrote: My second problem arises due to the fact that it should be possible to specify no value at all. [snip] Am I missing something obvious? I would appreciate any suggestions on this. If you want a single widget that allows you to specify "a positive integer or nothing" I think you'll need to look elsewhere. You may be building a better UI if you add a checkbox to cover the case where you don't want to specify an integer; i.e. ticking the box de-sensitises the spin button and signifies "None". OK, this is what I wanted to know. I guess I will implement it that way. Thanks, Niklas Volbers. ___ pygtk mailing list pygtk@daa.com.au http://www.daa.com.au/mailman/listinfo/pygtk Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/
[pygtk] SpinButton and a value of None
Hello everyone, I replaced some gtk.Entry widgets by the more appropriate gtk.SpinButton widgets. 'More appropriate' means that the user needs to enter an integer number > 0 and a spin button seemed predetermined for this. My first problem, which I finally solved, was that I have to set both a maximum and a minimum limit, so instead of specifying just widget.set_range(min=0) I have to use something like widget.set_range(min=0, max=sys.maxint) My second problem arises due to the fact that it should be possible to specify no value at all. This was easy for an entry widget: If the length of the text equals to zero, then I knew the text field was empty and I would set my internal value to None. However I could not find a way to let the user delete the contents of a spin button. Whenever I delete its contents it gets replaced by the last valid value again. Am I missing something obvious? I would appreciate any suggestions on this. Thanks, Niklas Volbers. ___ pygtk mailing list pygtk@daa.com.au http://www.daa.com.au/mailman/listinfo/pygtk Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/
Re: [pygtk] How to package the GTK envirement and the pyGTK with application?
batfree schrieb: I need my application to run on Windows without GTK,pyGTK ,python.How can I package these into a standalone application?Can any one help me? ___ pygtk mailing list pygtk@daa.com.au http://www.daa.com.au/mailman/listinfo/pygtk Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/ There is an useful application py2exe, which puts the runtime libraries into the executable. I haven't yet tried it myself, so I don't know what pitfalls there may be. Take care, Niklas. ___ pygtk mailing list pygtk@daa.com.au http://www.daa.com.au/mailman/listinfo/pygtk Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/
Re: [pygtk] question about graphs
nephish schrieb: hello there, i have an app here at work that i am working on, and i want to do some simple (keyword - simple) graphs. Nothing really fancy. Where would be the best place to look for how to do this ? i use debian linux, and python 2.3 thanks ___ pygtk mailing list pygtk@daa.com.au http://www.daa.com.au/mailman/listinfo/pygtk Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/ matplotlib has a very nice and easy functional interface: http://matplotlib.sf.net. You might also want to take a look at the python gnuplot interface: http://gnuplot-py.sourceforge.net/. Best regards, Niklas. ___ pygtk mailing list pygtk@daa.com.au http://www.daa.com.au/mailman/listinfo/pygtk Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/
Re: [pygtk] underscore in treeviewcolum title
Gian Mario Tagliaretti schrieb: 2005/9/4, N. Volbers <[EMAIL PROTECTED]>: Hello list, when I try to set the title of a TreeViewColumn to a name like 'a_name', then the underscore will be interpreted (as accelerator?) such that it will appear as 'aname' with an underscore under the 'n'. How can I turn off that behavior or how can I insert a true underscore? I tried '\_' but this did not work either. try to put 2 underscore 'a__name' cheers ...so simple... ! Thanks a lot, Niklas. ___ pygtk mailing list pygtk@daa.com.au http://www.daa.com.au/mailman/listinfo/pygtk Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/
[pygtk] underscore in treeviewcolum title
Hello list, when I try to set the title of a TreeViewColumn to a name like 'a_name', then the underscore will be interpreted (as accelerator?) such that it will appear as 'aname' with an underscore under the 'n'. How can I turn off that behavior or how can I insert a true underscore? I tried '\_' but this did not work either. Thanks, Niklas Volbers. ___ pygtk mailing list pygtk@daa.com.au http://www.daa.com.au/mailman/listinfo/pygtk Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/
Re: [pygtk] Undo and Redo
Jens Geiregat schrieb: Hi, I would like to add undo and redo buttons to my program. The problem is I do not have any idea how to implement the undo and redo-actions. Are there some (easy) examples on this subject? Or other (small) pygtk-programs that support undo and redo? Hello Jens, your question is a very interesting one! I had the same problem about a year ago when I started writing my application in python. As a starting point, I would advise you to look at the following three sources: 1. Skencil, a vector drawing program: http://www.nongnu.org/skencil/ by Bernhard Herzog. Look at "Documentation" and then at the "Developer's Guide". This is a very nice introduction to an undo mechanism that basically works like this: If you call an undoable function, then it must return an undo-tuple which contains the name of a function f and the appropriate arguments x,y,..., so that f(x,y,...) will undo the last action. This will also enable you to offer a "redo" mechanism for free! The only problem I had with this approach was that you waste the possibility to use the return value! 2. SloppyPlot, a plotting program, written by myself :-), http://sloppyplot.berlios.de It includes an Undo library (Sloppy.Lib.Undo) which works similar to the one found in Skencil, with the difference, that the undo information is appended to an undo list, which is passed to the function as keyword argument: def my_function(arg1, arg2, undolist=[]): undolist.append( ...undo information... ) The benefit of this approach is, that you can still return any value you like. Also, you can decide not to use the undo mechanism by simply not passing any undolist to the function. In this case, the undo information is appended to the [] list and is basically discarded! If you need more information, feel free to contact me. 3. Yet another approach is used by gazpacho (google for link), where for every action there is a wrapper with a do and an undo function. Hope this helps, Niklas. ___ pygtk mailing list pygtk@daa.com.au http://www.daa.com.au/mailman/listinfo/pygtk Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/
Re: [pygtk] refreshing a treeview
Prash schrieb: You could try the widget.queue_redraw as Niklas suggested in the 'treeview signals' thread. It may work .. I'll try it when I'm home tonight. On 6/22/05, Alexei Gilchrist <[EMAIL PROTECTED]> wrote: Hi, how do I refresh a treeview? I have a function which changes the scale of the font of the items (setting the scale property of the cellrenderer) but the height of the rows is then all wrong relative to the font size. If I collapse and open a node the height is then correct, but this is obviously a pain to do and can't be done for the root nodes. cheers, Alexei BTW: The function call is TreeView.queue_draw(). This is the older thread I was talking about: http://www.daa.com.au/pipermail/pygtk/2005-January/009476.html I have to admit I never filed a bug -- shame on me. Regards, Niklas. ___ pygtk mailing list pygtk@daa.com.au http://www.daa.com.au/mailman/listinfo/pygtk Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/
Re: [pygtk] Treeview signals
Hello, Prash wrote: What signal is emitted when a user clicks on a row? I've tried a few like row_activated but it emits a signal only when "return" is pressed. If you mean "double click on a row", try 'row-activated'. If you really want to catch basic mouse clicks, try 'button-pressed-event'. You can then determine the position from the event: x = int(event.x) y = int(event.y) Of course you usually want to know where you clicked, so you use something along the lines given here: try: path, col, cellx, celly = widget.get_path_at_pos(x, y) except TypeError: # blank region selected (no row) pass else: # example what to do if user clicked on a valid cell: # If user clicked on a row, then select it. selection = widget.get_selection() if selection.count_selected_rows() == 0: widget.grab_focus() widget.set_cursor( path, col, 0) I think this code snippet has been taken from an example on popup menus in the FAQ. Another problem is I'm using a button called "Expand" to expand everything using treeview.expand_all() but it shows the expanded tree only if I use alt+tab back and forth terminal and GUI - it appears there is some refresh problem. Any ideas? I remember me asking a similar question and I think this problem was solved in some gtk release. What gtk+ version are you using? If you don't want to update your gtk+, you can issue a redraw. I am not 100% sure, but I think you use widget.queue_draw() for this. Niklas. ___ pygtk mailing list pygtk@daa.com.au http://www.daa.com.au/mailman/listinfo/pygtk Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/
Re: [pygtk] Popup-menus
Eric Jardim schrieb: Hi, all... What do you know about this "popup-menu" event of the gtk.Widget class? Why it is not activated when someone right-click the widget? Anyway, it still can be stimulated by a method calling, isn't it? Why do people have to do catch the button_press_event, what is a little low level? Looking at Qt, the QWidget class has a "QWidget::contextMenuEvent" method that you just override and do what you want. Why does GTK does not has something similar? What do you have to say about all this? [Eric Jardim] Having thought a little about your question I realize that these two events are different, also from a user's point of view: - You can right click on a widget. Often this is a treeview widget. Then you might have a modifier key pressed down so that e.g. you select the item that you clicked on as well before calling the popup menu. - You can push the key on your keyboard that has the little popup menu sign. When you do this, there is no way to change the selection that the popup menu is referring to. So basically these really are two different actions. You can easily set up button_press_event to call the same method as the "popup-menu" event. This way you can have the same popup code for both a mouse click and for the popup key on your keyboard. Niklas Volbers. ___ pygtk mailing list pygtk@daa.com.au http://www.daa.com.au/mailman/listinfo/pygtk Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/
Re: [pygtk] Plugs and Sockets - newbie questions
Sebastien Aubry schrieb: Hello, The documentation about Plugs and Sockets did not allow me to find out whether they can be used to embed anything: - can they only be used to embed PyGtk widgets into another PyGtk window? - or can I embed anything using plugs and sockets ? You can embed any X window object into a gtk.Socket _if_ and only if you have the window's xwindow id. Take a look at the example in the pygtk tutorial! To embed an xterm: 1) start the xterm 2) execute "xwininfo". The mouse cursor will change to a crosshair. Select the xterm. The window information is displayed, e.g. xwininfo: Window id: 0x1ae "xterm" Absolute upper-left X: 5 Absolute upper-left Y: 649 Relative upper-left X: 5 Relative upper-left Y: 21 Width: 484 Height: 316 Depth: 24 Visual Class: TrueColor Border width: 0 Class: InputOutput Colormap: 0x20 (installed) Bit Gravity State: NorthWestGravity Window Gravity State: NorthWestGravity Backing Store State: NotUseful Save Under State: no Map State: IsViewable Override Redirect State: no Corners: +5+649 -791+649 -791-59 +5-59 -geometry 80x24+0-54 3) Now call socket.py with the given window id. A hex number on the command line would be misinterpreted by socket.py, so you need to convert the hex number beforehand, e.g. by calling long(windowid) in the python shell. >>> long(0x1ae) 27262990L Now on the command line $ python socket.py 27262990 Finished! The xterm is now reparented. So in principle, you can steal any window as long as you have its window id. Unfortunately I don't really know how to get this id from a Tkinter widget (the xwininfo method is not so thrilling). The next thing you will notice is that you can't type anything in the embedded xterm window. I believe this is only because the parent window steals the keyboard focus. I have used the plug/socket mechanism myself to embed a gnuplot window and I know that keyboard and mouse interaction worked for that. Regards, Niklas. A simple example of embedding an xterm (or a Tkinter window) as a widget inside a PyGtk window would be appreciated. Regards. Sébastien Aubry ___ pygtk mailing list pygtk@daa.com.au http://www.daa.com.au/mailman/listinfo/pygtk Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/ ___ pygtk mailing list pygtk@daa.com.au http://www.daa.com.au/mailman/listinfo/pygtk Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/
Re: [pygtk] Wrapping Gtksheet
N. Volbers schrieb: Christian Robottom Reis schrieb: On Thu, May 19, 2005 at 12:07:16PM +, Philippe Collet wrote: First reason is because of the futur implementations that can be done in the program i want to realize, it seems a better idea to integrate gtksheet now instead of integrating gtkgrid for the moment and soon gtksheet. Lorenzo raises an important question in this aspect: what do you need in GtkSheet that GtkTreeView doesn't give you already? If you can answer that question I can help guide your efforts. Take care, -- Christian Robottom Reis | http://async.com.br/~kiko/ | [+55 16] 3376 0125 ___ pygtk mailing list pygtk@daa.com.au http://www.daa.com.au/mailman/listinfo/pygtk Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/ You cannot mark only rows, not columns, with GtkTreeView (AFAIK). Niklas. Oops, sorry, I meant: You can only mark rows, not columns ;-) Niklas. ___ pygtk mailing list pygtk@daa.com.au http://www.daa.com.au/mailman/listinfo/pygtk Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/
Re: [pygtk] Wrapping Gtksheet
Christian Robottom Reis schrieb: On Thu, May 19, 2005 at 12:07:16PM +, Philippe Collet wrote: First reason is because of the futur implementations that can be done in the program i want to realize, it seems a better idea to integrate gtksheet now instead of integrating gtkgrid for the moment and soon gtksheet. Lorenzo raises an important question in this aspect: what do you need in GtkSheet that GtkTreeView doesn't give you already? If you can answer that question I can help guide your efforts. Take care, -- Christian Robottom Reis | http://async.com.br/~kiko/ | [+55 16] 3376 0125 ___ pygtk mailing list pygtk@daa.com.au http://www.daa.com.au/mailman/listinfo/pygtk Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/ You cannot mark only rows, not columns, with GtkTreeView (AFAIK). Niklas. ___ pygtk mailing list pygtk@daa.com.au http://www.daa.com.au/mailman/listinfo/pygtk Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/
Re: [pygtk] Wrapping Gtksheet
Hello, I just wanted to let you know that I would be willing to help with this. I am in dire need of a GtkGrid/PyGrid-like solution, and I would love to see this included in the standard gtk+ library. As I am not a very good C programmer (even though I understand C code pretty good), I could assist in documentation and testing, especially for the python part, so if you need any help, please let me know. Niklas. Rafael Villar Burke schrieb: Christian Robottom Reis wrote: On Wed, May 18, 2005 at 12:07:00PM +, Philippe Collet wrote: I'm a beginner in the wrapping process. I'm trying to create a wrapper to use gtksheet with pygtk. Philippe, it's great having some more people wrapping libraries like crazy!. But remember that there's ongoing work to add introspection capabilities to gobject, and it would make bindings mostly automatic. First question would be: why not work on GtkGrid, which /has/ a wrapper and will probably be less work to adapt? This is indeed a great suggestion. Philippe, would you dare to have a look to GtkGrid? It could eventually get into gtk+ itself and the problem would be solved at its root. If you're willing to hack on it here you have some additional information: GtkGrid design document and comments thread on gtk+ mailing list: http://mail.gnome.org/archives/gtk-devel-list/2004-April/msg00137.html Some more comments on gnome-db ML about inclusion in gtk+: http://mail.gnome.org/archives/gnome-db-list/2004-April/msg00048.html Gtk+ team meeting where gtkgrid is mentioned: http://mail.gnome.org/archives/gtk-devel-list/2004-April/msg00130.html Isn't it a nice and promising project to work on? ;) Regards, Pachi ___ pygtk mailing list pygtk@daa.com.au http://www.daa.com.au/mailman/listinfo/pygtk Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/ ___ pygtk mailing list pygtk@daa.com.au http://www.daa.com.au/mailman/listinfo/pygtk Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/
Re: [pygtk] Select a specific cell on a TreeView
Mauricio Tellez schrieb: Hi, I have a TreeView with 3 columns all the columns has a CellRendererText. What I want is that when the user click a specific cell, said row 2, column 1, only that cell get highlighted, not the entire row 2. Is posible to do this? How? Thanks in advance. No, this is not possible AFAIK. You would need to have a grid/sheet widget, which does not exist in the current GTK+ library. There is a bug report on bugzilla about this, but I don't know if anyone is tackling this problem. Howevery, you could try a workaround by changing the background color of the specific cell when the cell is clicked. Regards, Niklas. ___ pygtk mailing list pygtk@daa.com.au http://www.daa.com.au/mailman/listinfo/pygtk Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/
[pygtk] dockable toolbar windows a la GIMP
Hello everyone, I am looking for a pygtk equivalent of the window handling a la GIMP, i.e. the ability to group windows together by dragging them on docking areas or group windows into a notebook. Are there any ready solutions :-) ? I have started my own implementation of this (except for the drag'n drop yet). Now I have noticed, that in GIMP, when you group more than two windows underneath each other, they will be separated, so that you can change the size of each. How could one implement that? VPaned only supports two subwidgets. Of course, one could add one vpaned into another, but this seems awkward. Thanks for your help, Niklas. ___ pygtk mailing list pygtk@daa.com.au http://www.daa.com.au/mailman/listinfo/pygtk Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/
[pygtk] gtk.dsextras ?
Hello everyone, today I tried to build pygrid, which are the python bindings to gtkGrid. I receive an error, complaining that gtk.dsextras is not found. However, there is a file 'dsextras.py' in the site-packages/gtk-2.0 directory. Is this file deprecated or why is it not included ? What do I have to do to fix this? I am using pygtk 2.6.1 with gtk 2.6.4. Thanks, Niklas. ___ pygtk mailing list pygtk@daa.com.au http://www.daa.com.au/mailman/listinfo/pygtk Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/
[pygtk] how to redirect logging handlers?
Hello everyone, my app makes extensive use of the python 'logging' module. For easier development I would like to have a window with a treeview that should contain one entry for every log message sent. Is there any way to add a Handler so that the message is somehow sent to my treeview? Best regards, Niklas. ___ pygtk mailing list pygtk@daa.com.au http://www.daa.com.au/mailman/listinfo/pygtk Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/