Re: [pygtk] gtk.Notebook error

2009-11-10 Thread Alan Gauld

Amit Sethi amit.pureene...@gmail.com wrote 

 I am having problem with adding pages to gtk.Notebook :

I know nothing about Gtk so I could mbe missing 
something here but

 Now while creating I do :
 
 def new_tab(widget,widget_render):
   
notebook.new_tab(widget_render)
 
  notebook = SmNotebook()

These 2 lines look suspicious.
First you access a method of notebook then you 
assign a new object to notebook. Is the original object lost? 
Or is it doing something as a side-effect that keeps it around?
It seems to me it would be better to have two separate names 
for the two objects?

  box.pack_start(notebook)

This will be the new object used here, I assume thats what 
you wanted?

  box2=gtk.VBox()
  icons = gtk.STOCK_ABOUT
  image = gtk.Image()
  image.set_from_stock(icons, gtk.ICON_SIZE_DIALOG)
  box2.pack_start(image,False)
  button.connect(clicked, new_tab,box2)
 
 when I do this I get  a warning :   smnotebook.py:18: GtkWarning:
 Can't set a parent on widget which has a parent.

Do you get a full stack trace or just that one lline?
It always helps to see the full trace if its there.

HTH,


-- 
Alan Gauld
Author of the Learn to Program web site
http://www.alan-g.me.uk/

___
pygtk mailing list   pygtk@daa.com.au
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://faq.pygtk.org/


[pygtk] gtk.Notebook error

2009-07-13 Thread Amit Sethi
Hi ,
I am having problem with adding pages to gtk.Notebook :

What I want is to be able to pass a random container widget to a new tab:

thus my code is :

class SmNotebook(gtk.Notebook):
def __init__(self):
gtk.Notebook.__init__(self)
#set the tab properties
self.set_property('homogeneous', True)
#we do not show the tab if there is only one tab i total
self.set_property('show-tabs', True)

def new_tab(self,widget_to_render,title='Page'):
nbpages = self.get_n_pages()
self.append_page(widget_to_render)

Now while creating I do :

def new_tab(widget,widget_render):

notebook.new_tab(widget_render)

  notebook = SmNotebook()
  box.pack_start(notebook)
  box2=gtk.VBox()
  icons = gtk.STOCK_ABOUT
  image = gtk.Image()
  image.set_from_stock(icons, gtk.ICON_SIZE_DIALOG)
  box2.pack_start(image,False)
  button.connect(clicked, new_tab,box2)

* I have deleted the parts of the code that did not seem to be
required . The later part of the code is just for testing..


when I do this I get  a warning :   smnotebook.py:18: GtkWarning:
Can't set a parent on widget which has a parent.


what am I doing wrong here??


-- 
A-M-I-T S|S
___
pygtk mailing list   pygtk@daa.com.au
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://faq.pygtk.org/


[pygtk] gtk.Notebook

2008-07-09 Thread [EMAIL PROTECTED]

In gtk notebook page_num(child) being a widget
Returns :   the index of the page containing child, or -1

So here is the problem:

Added button to tab for close so I need the page the button is on since the
button grabs focus rather than the tab. I tried emit back to parent and that 
failed to produce anything.

The code segements:

Creation:
   #--
   def new_page(self, arg, filename):
  self.z = self.z + 1
  # create  scroller, gtksourceview, buffer and set mime
  scroller = gtk.ScrolledWindow()
  scroller.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
  bufferS = gtksourceview.SourceBuffer()
  manager = gtksourceview.SourceLanguagesManager()
  if arg:
 type = gnomevfs.get_mime_type(arg)
 language = manager.get_language_from_mime_type(type)
  else:
 language = manager.get_language_from_mime_type('text')
  bufferS.set_language(language)
  view = gtksourceview.SourceView(bufferS)
  scroller.add(view)
  # set defaults for gtksourceview and buffer
  bufferS.set_highlight(self.HIGHLIGHT)
  bufferS.set_check_brackets(self.CHECK_BRACKETS)
  view.set_show_line_numbers(self.SHOW_LINE_NUMBERS)
  view.set_show_margin(self.SHOW_MARGIN)
  view.set_auto_indent(self.AUTO_INDENT)
  view.set_tabs_width(int(self.TABS_WIDTH))
  view.set_insert_spaces_instead_of_tabs(self.INSERT_SPACES_INSTEAD_OF_TABS)
  view.set_margin(int(self.MARGIN))
  # add close button
  image = gtk.Image()
  image.set_from_file(data/images/close.png)
  btn = gtk.Button()
  btn.add(image)
  btn.connect('clicked',self.on_close_btn)
  #btn.set_size_request(16,16)
  # add label
  hbox = gtk.HBox(False,3)
  if not arg:
 self.key[self.z] = gtk.Label(filename)
  else:
 self.key[self.z] = gtk.Label(filename.rsplit('/',1)[1])
  hbox.add(self.key[self.z])
  hbox.add(btn)
  hbox.show_all()
  # load and set text
  if arg:
 try:
bufferS.begin_not_undoable_action()
f = open(arg, 'r')
bufferS.set_text(f.read())
f.close()
bufferS.end_not_undoable_action()  
 except:
print 'File Error: '+arg
  else:
 bufferS.set_text('')
  # populate tree
  iter = None
  iter = self.mod.append(iter)
  if arg:
 self.mod.set(iter,0, arg)
  else:
 self.mod.set(iter,0, filename)
  self.mod.set(iter,1, self.key[self.z].get_text())
  self.mod.set(iter,2, view)
  self.mod.set(iter,3, bufferS)
  self.mod.set(iter,4, self.key[self.z])
  self.view = view
  self.bufferS = bufferS
  # add page
  page = self.mdi_book.append_page(scroller,hbox)
  self.mdi_book.show_all()
  # switch to page
  self.mdi_book.set_current_page(page)
 
 Callbacks:
#--
   def on_close_btn(self, widget):
  p = self.mdi_book.page_num(widget)
  self.on_update_tree('delete')
  self.mdi_book.remove_page(p)   
   #--
   def on_close(self, widget):
  p = self.mdi_book.get_current_page()
  self.on_update_tree('delete')
  self.mdi_book.remove_page(p)   

 




___
Join Excite! - http://www.excite.com
The most personalized portal on the Web!


___
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

2008-01-07 Thread Seltzer
if using PyGTK 2.4, maybe try moving your connect down further, and sending
the index that append_page returns
to your handler. something like...

...
page = self.mdi_book.append_page(scroller,hbox)
btn.connect('clicked', self.on_close_btn, page)
...
def on_close_btn(self, widget,data):
do_stuff_with_data

hope it helps.
felix


On Jan 6, 2008 6:19 PM, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:


 In gtk notebook page_num(child) being a widget
 Returns : the index of the page containing child, or -1

 So here is the problem:

 Added button to tab for close so I need the page the button is on since
 the
 button grabs focus rather than the tab. I tried emit back to parent and
 that
 failed to produce anything.

 The code segements:

 Creation:

 #--
   def new_page(self, arg, filename):
  self.z = self.z + 1
  # create  scroller, gtksourceview, buffer and set mime
  scroller = gtk.ScrolledWindow()
  scroller.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
  bufferS = gtksourceview.SourceBuffer()
  manager = gtksourceview.SourceLanguagesManager()
  if arg:
 type = gnomevfs.get_mime_type(arg)
 language = manager.get_language_from_mime_type(type)
  else:
 language = manager.get_language_from_mime_type('text')
  bufferS.set_language(language)
  view = gtksourceview.SourceView(bufferS)
  scroller.add(view)
  # set defaults for gtksourceview and buffer
  bufferS.set_highlight(self.HIGHLIGHT)
  bufferS.set_check_brackets(self.CHECK_BRACKETS)
  view.set_show_line_numbers(self.SHOW_LINE_NUMBERS)
  view.set_show_margin(self.SHOW_MARGIN)
  view.set_auto_indent(self.AUTO_INDENT)
  view.set_tabs_width(int(self.TABS_WIDTH))
  view.set_insert_spaces_instead_of_tabs(
 self.INSERT_SPACES_INSTEAD_OF_TABS)
  view.set_margin(int(self.MARGIN))
  # add close button
  image = gtk.Image()
  image.set_from_file(data/images/close.png)
  btn = gtk.Button()
  btn.add(image)
  btn.connect('clicked',self.on_close_btn)
  #btn.set_size_request(16,16)
  # add label
  hbox = gtk.HBox(False,3)
  if not arg:
 self.key[self.z] = gtk.Label(filename)
  else:
 self.key[self.z] = gtk.Label(filename.rsplit('/',1)[1])
  hbox.add(self.key[self.z])
  hbox.add(btn)
  hbox.show_all()
  # load and set text
  if arg:
 try:
bufferS.begin_not_undoable_action()
f = open(arg, 'r')
bufferS.set_text(f.read())
f.close()
bufferS.end_not_undoable_action()
 except:
print 'File Error: '+arg
  else:
 bufferS.set_text('')
  # populate tree
  iter = None
  iter = self.mod.append(iter)
  if arg:
 self.mod.set(iter,0, arg)
  else:
 self.mod.set(iter,0, filename)
  self.mod.set(iter,1, self.key[self.z].get_text())
  self.mod.set(iter,2, view)
  self.mod.set(iter,3, bufferS)
  self.mod.set(iter,4, self.key[self.z])
  self.view = view
  self.bufferS = bufferS
  # add page
  page = self.mdi_book.append_page(scroller,hbox)
  self.mdi_book.show_all()
  # switch to page
  self.mdi_book.set_current_page(page)

 Callbacks:

  #--
   def on_close_btn(self, widget):
  page = self.mdi_book.page_num(widget)
  print page

 #--
   def on_close(self, widget):
  p = self.mdi_book.get_current_page()
  self.on_update_tree('delete')
  self.mdi_book.remove_page(p)





 ___
 Join Excite! - http://www.excite.com
 The most personalized portal on the Web!


 ___
 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] gtk.Notebook

2008-01-07 Thread Sylvain Saleur
Hello.

I just copy a small program I've done which generate a notebook with a
close button. Hopefully it will be helpful for you.

#!/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):
Function that add the icon to the button
#Hbox creation
iconBox = gtk.HBox(False, 0)
#Empty image creation
image = gtk.Image()
#Let's get the default gtk close button
image.set_from_stock(gtk.STOCK_CLOSE,gtk.ICON_SIZE_MENU)
#set the relief off
gtk.Button.set_relief(button,gtk.RELIEF_NONE)
#Get the settings of the button
settings = gtk.Widget.get_settings(button)
#w and h dimensions of the button
(w,h) = gtk.icon_size_lookup_for_settings(settings,gtk.ICON_SIZE_MENU)
#modification of the dimensions
gtk.Widget.set_size_request(button, w + 4, h + 4)
image.show()
#pack the image in the box
iconBox.pack_start(image, True, False, 0)
#add the box in the button
button.add(iconBox)
iconBox.show()
return

def create_custom_tab(self,text, notebook, frame):
Create a custom tab with a label and the button
#eventbox creation
eventBox = gtk.EventBox()
#Hbox creation
tabBox = gtk.HBox(False, 2)
#text label creation
tabLabel = gtk.Label(text)
#creation of a button
tabButton=gtk.Button()
#connect to the remove_book function
tabButton.connect('clicked',self.remove_book, notebook, frame)

#add the icon with the previously defined add_icon_to_button
self.add_icon_to_button(tabButton)

eventBox.show()
tabButton.show()
tabLabel.show()
#add label and button
tabBox.pack_start(tabLabel, False)
tabBox.pack_start(tabButton, False)

tabBox.show_all()
#add the box to the eventox
eventBox.add(tabBox)
return eventBox


def remove_book(self, button, notebook, frame):
Function to remove the page
#suppress the page. You must give the child widget of the page
notebook.remove(frame)
# you call the previous page
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)

#book generation
notebook = gtk.Notebook()
window.add(notebook)
notebook.show()

# some 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(In the Frame %d % page_number)
frame.add(label)
label.show()

eventBox = self.create_custom_tab(Tab %d % page_number,
notebook, frame)
notebook.append_page(frame, eventBox)
# page you see at the opening
notebook.set_current_page(3)
window.show()

def main():
gtk.main()
return 0

if __name__ == __main__:

NotebookExample()

main()

I'm sure we can do that more quickly but it works and as you can see
in the code style, I'm not a specialist...

Hope it will help you.

Sylvain

2008/1/7, [EMAIL PROTECTED] [EMAIL PROTECTED]:

 In gtk notebook page_num(child) being a widget
 Returns : the index of the page containing child, or -1

 So here is the problem:

 Added button to tab for close so I need the page the button is on since the
 button grabs focus rather than the tab. I tried emit back to parent and that
 failed to produce anything.

 The code segements:

 Creation:
#--
def new_page(self, arg, filename):
   self.z = self.z + 1
   # create  scroller, gtksourceview, buffer and set mime
   scroller = gtk.ScrolledWindow()
   scroller.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
   bufferS = gtksourceview.SourceBuffer()
   manager = gtksourceview.SourceLanguagesManager()
   if arg:
  type = gnomevfs.get_mime_type(arg)
  language = manager.get_language_from_mime_type(type)
   else:
  language = manager.get_language_from_mime_type('text')
   bufferS.set_language(language)
   view = gtksourceview.SourceView(bufferS)
   scroller.add(view)
   # set defaults for gtksourceview and buffer
   bufferS.set_highlight(self.HIGHLIGHT)
   bufferS.set_check_brackets(self.CHECK_BRACKETS)
   view.set_show_line_numbers(self.SHOW_LINE_NUMBERS)
   view.set_show_margin(self.SHOW_MARGIN)
   view.set_auto_indent(self.AUTO_INDENT)
   view.set_tabs_width(int(self.TABS_WIDTH))
   
 

[pygtk] gtk.Notebook

2008-01-06 Thread [EMAIL PROTECTED]

In gtk notebook page_num(child) being a widget
Returns : the index of the page containing child, or -1

So here is the problem:

Added button to tab for close so I need the page the button is on since the
button grabs focus rather than the tab. I tried emit back to parent and that
failed to produce anything.

The code segements:

Creation:
   #--
   def new_page(self, arg, filename):
  self.z = self.z + 1
  # create  scroller, gtksourceview, buffer and set mime
  scroller = gtk.ScrolledWindow()
  scroller.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
  bufferS = gtksourceview.SourceBuffer()
  manager = gtksourceview.SourceLanguagesManager()
  if arg:
 type = gnomevfs.get_mime_type(arg)
 language = manager.get_language_from_mime_type(type)
  else:
 language = manager.get_language_from_mime_type('text')
  bufferS.set_language(language)
  view = gtksourceview.SourceView(bufferS)
  scroller.add(view)
  # set defaults for gtksourceview and buffer
  bufferS.set_highlight(self.HIGHLIGHT)
  bufferS.set_check_brackets(self.CHECK_BRACKETS)
  view.set_show_line_numbers(self.SHOW_LINE_NUMBERS)
  view.set_show_margin(self.SHOW_MARGIN)
  view.set_auto_indent(self.AUTO_INDENT)
  view.set_tabs_width(int(self.TABS_WIDTH))
  view.set_insert_spaces_instead_of_tabs(self.INSERT_SPACES_INSTEAD_OF_TABS)
  view.set_margin(int(self.MARGIN))
  # add close button
  image = gtk.Image()
  image.set_from_file(data/images/close.png)
  btn = gtk.Button()
  btn.add(image)
  btn.connect('clicked',self.on_close_btn)
  #btn.set_size_request(16,16)
  # add label
  hbox = gtk.HBox(False,3)
  if not arg:
 self.key[self.z] = gtk.Label(filename)
  else:
 self.key[self.z] = gtk.Label(filename.rsplit('/',1)[1])
  hbox.add(self.key[self.z])
  hbox.add(btn)
  hbox.show_all()
  # load and set text
  if arg:
 try:
bufferS.begin_not_undoable_action()
f = open(arg, 'r')
bufferS.set_text(f.read())
f.close()
bufferS.end_not_undoable_action()  
 except:
print 'File Error: '+arg
  else:
 bufferS.set_text('')
  # populate tree
  iter = None
  iter = self.mod.append(iter)
  if arg:
 self.mod.set(iter,0, arg)
  else:
 self.mod.set(iter,0, filename)
  self.mod.set(iter,1, self.key[self.z].get_text())
  self.mod.set(iter,2, view)
  self.mod.set(iter,3, bufferS)
  self.mod.set(iter,4, self.key[self.z])
  self.view = view
  self.bufferS = bufferS
  # add page
  page = self.mdi_book.append_page(scroller,hbox)
  self.mdi_book.show_all()
  # switch to page
  self.mdi_book.set_current_page(page)

Callbacks:
#--
   def on_close_btn(self, widget):
  page = self.mdi_book.page_num(widget)
  print page
   #--
   def on_close(self, widget):
  p = self.mdi_book.get_current_page()
  self.on_update_tree('delete')
  self.mdi_book.remove_page(p)   
 




___
Join Excite! - http://www.excite.com
The most personalized portal on the Web!


___
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]

2007-05-06 Thread N. Volbers
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] gtk.Notebook dnd to other widgets [SOLVED]

2007-05-06 Thread Gian Mario Tagliaretti

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
--
Gian Mario Tagliaretti
___
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]

2007-05-06 Thread N. Volbers
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/


[pygtk] gtk.Notebook dnd to other widgets

2007-05-04 Thread Niklas Volbers
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

import gtk


nb = gtk.Notebook()

# fill first notebook with tabs containing a label
for text in (One, Two, Three):
label = gtk.Label(\n%s\n%text)
nb.append_page(label)
nb.set_tab_reorderable(label, True)
nb.set_tab_detachable(label, True)


# add event box
label = gtk.Label(Drop here)

event_box = gtk.EventBox()
event_box.set_size_request(-1, 40)
event_box.add(label)


# From the PyGTK documentation:

# If you want a widget to interact with a notebook through DnD (i.e.:
# accept dragged tabs from it) it must be set as a drop destination
# and accept the target gtk.NOTEBOOK_TAB. The notebook will fill the
# selection with a reference to the child widget that corresponds to
# the dropped tab.

event_box.drag_dest_set(gtk.DEST_DEFAULT_ALL,
[(gtk.NOTEBOOK_TAB,gtk.TARGET_SAME_APP,42)],
gtk.gdk.ACTION_MOVE)


# set up dnd
def on_dnd_drag_leave(sender, context, time):
print on_dnd_drag_leave
sender.modify_bg(gtk.STATE_NORMAL, None)

def on_dnd_drag_motion(sender, context, x, y, time):
print on_dnd_drag_motion
color = gtk.gdk.Color(65535,0,0)
sender.modify_bg(gtk.STATE_NORMAL, color)

def on_dnd_drag_drop(sender, context, x, y, time):
print on_dnd_drag_drop

event_box.connect(drag-leave, on_dnd_drag_leave)
event_box.connect(drag-motion, on_dnd_drag_motion)
event_box.connect(drag-drop, on_dnd_drag_drop)



# put everything in a window
win = gtk.Window()
win.connect(destroy, gtk.main_quit)
vbox = gtk.VBox()
vbox.add(nb)
vbox.add(event_box)
win.add(vbox)
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] gtk.Notebook()

2005-08-19 Thread Luigi Pantano
How to change the tab position like gaim?
-- 
Luigi Pantano
---
IPUG - Italian Python User Group
www.italianpug.org
https://py-tips-tricks.python-hosting.com/
---
___
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()

2005-08-19 Thread Gian Mario Tagliaretti
2005/8/19, Luigi Pantano [EMAIL PROTECTED]:
 How to change the tab position like gaim?

if I understood correctly:
http://www.pygtk.org/pygtk2reference/class-gtknotebook.html#method-gtknotebook--set-tab-pos

ciao
-- 
Gian Mario Tagliaretti
PyGTK GUI programming
http://www.parafernalia.org/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: [Matplotlib-users] Re: [pygtk] Gtk.Notebook problem in PyGTK 2.6

2005-06-02 Thread dimitri pater
I then click on the 'graph' Tab and the 'make graph!' button and get:Traceback (most recent call last):
File testMPL-GTK.py, line 55, in createProjectGraphp1 = self.axis.bar(ind, int(age), width, color='r')ValueError: invalid literal for int():
You should enter two values before creating the graph (use the two text entries located above the button)
It should work then
(remember, this only a test app)
Thnaks for trying,
Dimitri

___
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: [Matplotlib-users] Re: [pygtk] Gtk.Notebook problem in PyGTK 2.6

2005-06-01 Thread dimitri pater
I made a small test app which clearly shows that Matplotlib 0.8 and PyGTK 2.6 don't work well together. No problem in PyGTK 2.4

bye,
DimtiriOn 6/1/05, N. Volbers [EMAIL PROTECTED] wrote:
dimitri pater schrieb: Yes, this could could very well be a matplotlib issue. I will try to do some tests, thanks for cc'ing it to the matplotlib list. Dimitri On 5/31/05, *John Gill* 
[EMAIL PROTECTED] mailto:[EMAIL PROTECTED] wrote: I think this might be a matplotlib issue.
 I've been having some refresh issues with matplotlib since switching to 2.6.In particular I've noticed that if I put my mouse over the toolbar and let a tooltip pop up the canvas does
 not get repainted. Up to now I'd been assuming this problem was isolated to me (I use ratpoison as a window manager, which can confuse some apps). I've cc'ed the matplotlib list in case anyone can throw some light
 on this. John dimitri pater wrote: Hello, I upgraded to PyGTK 2.6 from 2.4 . Now, when I switch from page 2 on a 
Gtk.Notebook back to page 1, page 1 still shows some elements from page 2 (it is not refreshed, just some parts). Both pages contain graphs created with Matplotlib. I never had problems like this with 
2.4... Any clues somebody? If necessary, I will attach the source files. Best regards, Dimitri
___pygtk mailing listpygtk@daa.com.au mailto:pygtk@daa.com.au
http://www.daa.com.au/mailman/listinfo/pygtkRead the PyGTK FAQ:http://www.async.com.br/faq/pygtk/
 -- Please visit dimitri's website: www.serpia.com http://www.serpia.com
I can confirm this (mis)behaviour with matplotlib 0.80 and gtk+/pygtk2.6.I had wanted to look into this matter, but didn't yet have time todo it.A simple guess would be that the expose-event is not handled
properly by the GTK backend.I noticed the problem when I put a menu-bar over a matplotlib GTKCanvas.When you leave an opened menu, the menu will not disappear.Niklas.
-- Please visit dimitri's website: www.serpia.com


testMPL-GTK.py
Description: application/python


project1.glade
Description: Binary data
___
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: [Matplotlib-users] Re: [pygtk] Gtk.Notebook problem in PyGTK 2.6

2005-06-01 Thread Steve Chaplin
On Wed, 2005-06-01 at 05:12 -0700, matplotlib-users-
[EMAIL PROTECTED] wrote:
  I made a small test app which clearly shows that Matplotlib 0.8 and
  PyGTK 2.6 don't work well together. No problem in PyGTK 2.4
  
  bye,
  Dimtiri

I have problems with it in PyGTK 2.4

$ python testMPL-GTK.py
(testMPL-GTK.py:12685): libglade-WARNING **: unknown property
`focus_on_map' for class `GtkWindow'

(testMPL-GTK.py:12685): libglade-WARNING **: unknown property
`ellipsize' for class `GtkLabel'
...

I then click on the 'graph' Tab and the 'make graph!' button and get:
Traceback (most recent call last):
  File testMPL-GTK.py, line 55, in createProjectGraph
p1 = self.axis.bar(ind, int(age), width, color='r')
ValueError: invalid literal for int():


Do you think this is a gtk.Notebook problem or a matplotlib
FigureCanvasGTK widget problem?
If its a FigureCanvasGTK problem then you should be able to forget about
the gtk.Notebook and run
matplotlib/examples/embedding_in_gtk.py, or 
matplotlib/examples/embedding_in_gtk2.py and demonstrate the problem.

Try running embedding_in_gtk.py and moving another window partly in
front of it, then click the embedding_in_gtk window to bring it back on
top - does the window get redrawn?

I can verify that on PyGTK 2.4 on Linux it works fine.
Could you test it on PyGTK 2.6, and also report the operating system you
are using.

Steve

Send instant messages to your online friends http://au.messenger.yahoo.com 
___
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: [Matplotlib-users] Re: [pygtk] Gtk.Notebook problem in PyGTK 2.6

2005-06-01 Thread John Hunter
 Steve == Steve Chaplin [EMAIL PROTECTED] writes:

Steve Try running embedding_in_gtk.py and moving another window
Steve partly in front of it, then click the embedding_in_gtk
Steve window to bring it back on top - does the window get
Steve redrawn?

Steve I can verify that on PyGTK 2.4 on Linux it works fine.
Steve Could you test it on PyGTK 2.6, and also report the
Steve operating system you are using.

I get the problem in Ubuntu Hoary Hedgehog ( 2.16.10 I think), with a
normal mpl pylab figure in GTKAgg.  It is hard to see with normal
figure sizes, because the tooltips by default appear below the toolbar
and thus do not occlude the FigureCanvas, but if you resize the figure
so that it takes up the entire vertical extent of the desktop, and
then hover over the toolbar, the tooltips will occlude the canvas and
will expose the bug -- no pun intended :-)  The basic problem is that
the area occluded by the tooltip is not redrawn when, for example, you
hover over a different toolbar button.

JDH
___
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 problem in PyGTK 2.6

2005-05-31 Thread John Gill




I think this might be a matplotlib issue.

I've been having some refresh issues with matplotlib since switching to
2.6. In particular I've noticed that if I put my mouse over the
toolbar and let a tooltip pop up the canvas does not get repainted.

Up to now I'd been assuming this problem was isolated to me (I use
ratpoison as a window manager, which can confuse some apps).

I've cc'ed the matplotlib list in case anyone can throw some light on
this.

John

dimitri pater wrote:

  
Hello,
I upgraded to PyGTK 2.6 from 2.4 . Now, when I switch from page 2 on a
Gtk.Notebook back to page 1, page 1 still shows some elements from page
2 (it is not refreshed, just some parts). Both pages contain graphs
created with Matplotlib. I never had problems like this with 2.4...
Any clues somebody? If necessary, I will attach the source files.
  
Best regards,
Dimitri
  
  

___
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] Gtk.Notebook problem in PyGTK 2.6

2005-05-31 Thread dimitri pater
Yes, this could could very well be a matplotlib issue. I will try to do some tests, thanks for cc'ing it to the matplotlib list.

DimitriOn 5/31/05, John Gill [EMAIL PROTECTED] wrote:



  
  


I think this might be a matplotlib issue.

I've been having some refresh issues with matplotlib since switching to
2.6. In particular I've noticed that if I put my mouse over the
toolbar and let a tooltip pop up the canvas does not get repainted.

Up to now I'd been assuming this problem was isolated to me (I use
ratpoison as a window manager, which can confuse some apps).

I've cc'ed the matplotlib list in case anyone can throw some light on
this.

John

dimitri pater wrote:

  
Hello,
I upgraded to PyGTK 2.6 from 2.4 . Now, when I switch from page 2 on a
Gtk.Notebook back to page 1, page 1 still shows some elements from page
2 (it is not refreshed, just some parts). Both pages contain graphs
created with Matplotlib. I never had problems like this with 2.4...
Any clues somebody? If necessary, I will attach the source files.
  
Best regards,
Dimitri
  
  ___pygtk mailing list   
pygtk@daa.com.auhttp://www.daa.com.au/mailman/listinfo/pygtkRead the PyGTK FAQ: 
http://www.async.com.br/faq/pygtk/  




-- Please visit dimitri's website: www.serpia.com
___
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.Notebook problem in PyGTK 2.6

2005-05-30 Thread dimitri pater
Hello,
I upgraded to PyGTK 2.6 from 2.4 . Now, when I switch from page 2 on a
Gtk.Notebook back to page 1, page 1 still shows some elements from page
2 (it is not refreshed, just some parts). Both pages contain graphs
created with Matplotlib. I never had problems like this with 2.4...
Any clues somebody? If necessary, I will attach the source files.

Best regards,
Dimitri
___
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

2005-03-23 Thread Christian Reis
On Tue, Mar 22, 2005 at 07:16:03PM +0200, Paul Malherbe wrote:
 It is a financial program. The basics are as follows:
 
 Page 1
 
 The operator enters the details of e.g. a payment i.e. date, reference
 number amount, description etc.
 
 Page 2
 
 The operator allocates the amount to one or more nominal ledger accounts.
 Based on the type of account allocated to e.g. Accounts Receivable control
 the operator would have to allocate it to an individual customer's account

 i.e. Page 3 or if the account was an Accounts Payable control to the
 individual supplier's account i.e.Page 4. Pages 3 and 4 differ as to the
 type and content of information therefore 2 different pages.

This is a classical wizard. It may be that the wizard starts on Page 2
(and you have an explicit task to trigger it), or at Page 1 -- this all
depends on how much time the user actually spends entering the data of
the payment, or if he will enter a list of payments and then decide to
allocate it, or yet if he just enters a payment and goes on to step 2.

At any rate, I am quite sure that putting all the different pages inside
the same window (and the same notebook, for that reason) is the wrong
design for what you want. Model workflows (s/Page/Step/ and you may see
what I mean) either as a set of windows, or as a wizard -- not as pages
in a notebook.

Take care,
--
Christian Robottom Reis | http://async.com.br/~kiko/ | [+55 16] 3361 2331
___
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

2005-03-23 Thread Nikos Kouremenos
On Wed, 23 Mar 2005 08:43:39 -0300, Christian Reis [EMAIL PROTECTED] wrote:
 This is a classical wizard. 
I also believe it's a classical wizard situation. GTK doesn't have a
wizard widget or am I wrong?
If I'm right (I must be :^)) what's the proposed way of implementing a
wizard in GTK? [I'm a Glade lover]
-- 
Nikos Kouremenos | Jabber ID: [EMAIL PROTECTED] | http://members.hellug.gr/nkour
___
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

2005-03-23 Thread Steve McClure
On Wed, 2005-03-23 at 09:21, Nikos Kouremenos wrote:
 On Wed, 23 Mar 2005 08:43:39 -0300, Christian Reis [EMAIL PROTECTED] wrote:
  This is a classical wizard. 
 I also believe it's a classical wizard situation. GTK doesn't have a
 wizard widget or am I wrong?
 If I'm right (I must be :^)) what's the proposed way of implementing a
 wizard in GTK? [I'm a Glade lover]

Gtk doesn't, but there is a GnomeDruid and Glade supports it too.  At
one point in time I was trying to stick solely with Gtk so I used the
GtkNotebook and hid the tabs. Then switched pages whenever the user hit
the Next and Previous buttons.
-- 
Steve McClure   Racemi
email: [EMAIL PROTECTED]75 5th St NE
voice: 404-892-5850 Suite 333
fax: 404-892-7215   Atlanta, GA 30308
http://www.racemi.com

___
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

2005-03-23 Thread Thomas Mills Hinkle
 Gtk doesn't, but there is a GnomeDruid and Glade supports it too.  At
 one point in time I was trying to stick solely with Gtk so I used the
 GtkNotebook and hid the tabs. Then switched pages whenever the user hit
 the Next and Previous buttons.

I was recently in a similar situation -- I wanted to use a Wizard
and didn't know how -- first I couln't remember what GNOME called it,
then I thought it was a GNOME-only widget anyway.

So that leaves the question -- is there any way to bring something
like the druid into a standard GTK toolkit?

I made the decision to keep my app gtk-only after getting complaints
from non-GNOME users about the number of packages they had to install
to run it; now I have a Windows port and a number of Windows users, so
there's no going back. That said, I'd still like to try to use the
right tool for the job :)

Tom
___
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

2005-03-23 Thread Andy Wingo
Hi Nikos,

Fluendo has written some GPL wizard frameworks using glade, etc. Don't
know if that fits with your licensing requirements. You'd probably be
interested in the simple one here:

https://core.fluendo.com/trac/cgi-bin/trac.cgi/file/flumotion/trunk/flumotion/admin/gtk/wizard.py

Here's an example of a wizard implemented on that framework:

https://core.fluendo.com/trac/cgi-bin/trac.cgi/file/flumotion/trunk/flumotion/admin/gtk/greeter.py

Whatever you use, you really don't want GnomeDruid in its C incarnation.
Doing it in python means making a qualitatively different product than
if you used a C library.

Regards,
-- 
Andy Wingo
http://wingolog.org/

___
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

2005-03-23 Thread Chris Lambacher
you can always impliment a wizard using a Notebook with no tabs and a
couple of buttons at the bottom of the screen, which is what I did for
one of my apps.

-Chris


On Wed, 23 Mar 2005 17:17:38 +0100, Andy Wingo [EMAIL PROTECTED] wrote:
 Hi Nikos,
 
 Fluendo has written some GPL wizard frameworks using glade, etc. Don't
 know if that fits with your licensing requirements. You'd probably be
 interested in the simple one here:
 
 https://core.fluendo.com/trac/cgi-bin/trac.cgi/file/flumotion/trunk/flumotion/admin/gtk/wizard.py
 
 Here's an example of a wizard implemented on that framework:
 
 https://core.fluendo.com/trac/cgi-bin/trac.cgi/file/flumotion/trunk/flumotion/admin/gtk/greeter.py
 
 Whatever you use, you really don't want GnomeDruid in its C incarnation.
 Doing it in python means making a qualitatively different product than
 if you used a C library.
 
 Regards,
 --
 Andy Wingo
 http://wingolog.org/
 
 ___
 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/
 


-- 
Christopher Lambacher
[EMAIL PROTECTED]
___
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

2005-03-22 Thread Nikos Kouremenos
On Mon, 21 Mar 2005 23:01:55 +0200 (SAST), Paul Malherbe
[EMAIL PROTECTED] wrote:
 I am writing a program using gtk.Notebook with about five pages.
 The question therefore is how can I selectively disallow access to these
 pages.

hm, someone some weeks ago wanted to disable (deactivate) tabs. I
think he got a reply saying that this is not the best Design ever. If
you cannot avoid that design, then make add/remove the pages instead
of disallowing access to these pages which I think you be to
deactivated them so they are not clickabe

-- 
Nikos Kouremenos | Jabber ID: [EMAIL PROTECTED] | http://members.hellug.gr/nkour
___
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

2005-03-22 Thread Paul Malherbe
 On Mon, 21 Mar 2005 23:01:55 +0200 (SAST), Paul Malherbe
 [EMAIL PROTECTED] wrote:
 I am writing a program using gtk.Notebook with about five pages.
 The question therefore is how can I selectively disallow access to these
 pages.

 hm, someone some weeks ago wanted to disable (deactivate) tabs. I
 think he got a reply saying that this is not the best Design ever. If
 you cannot avoid that design, then make add/remove the pages instead
 of disallowing access to these pages which I think you be to
 deactivated them so they are not clickabe

 --
 Nikos Kouremenos | Jabber ID: [EMAIL PROTECTED] |
 http://members.hellug.gr/nkour


The problem I have is that responses on one page of the notebook can
determine which of the other pages should be accessed. Also I need the
data to be entered in a logical sequence therefore I would like to disable
access to the next page until the current page has been completed.

Thanks, Paul

___
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

2005-03-22 Thread Christian Robottom Reis
On Tue, Mar 22, 2005 at 06:47:39PM +0200, Paul Malherbe wrote:
 The problem I have is that responses on one page of the notebook can
 determine which of the other pages should be accessed. Also I need the
 data to be entered in a logical sequence therefore I would like to disable
 access to the next page until the current page has been completed.

Sounds like a wizard, not like a notebook. There's a reason widgets are
designed the way they are wink

Take care,
--
Christian Robottom Reis | http://async.com.br/~kiko/ | [+55 16] 3361 2331
___
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

2005-03-22 Thread Paul Malherbe
 On Tue, Mar 22, 2005 at 06:47:39PM +0200, Paul Malherbe wrote:
 The problem I have is that responses on one page of the notebook can
 determine which of the other pages should be accessed. Also I need the
 data to be entered in a logical sequence therefore I would like to
 disable
 access to the next page until the current page has been completed.

 Sounds like a wizard, not like a notebook. There's a reason widgets are
 designed the way they are wink

 Take care,
 --
 Christian Robottom Reis | http://async.com.br/~kiko/ | [+55 16] 3361 2331


It is a financial program. The basics are as follows:

Page 1

The operator enters the details of e.g. a payment i.e. date, reference
number amount, description etc.

Page 2

The operator allocates the amount to one or more nominal ledger accounts.
Based on the type of account allocated to e.g. Accounts Receivable control
the operator would have to allocate it to an individual customer's account
i.e. Page 3 or if the account was an Accounts Payable control to the
individual supplier's account i.e.Page 4. Pages 3 and 4 differ as to the
type and content of information therefore 2 different pages.

Thanks, Paul
___
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.Notebook

2005-03-21 Thread Paul Malherbe
Hi

I need some help, please.

I am writing a program using gtk.Notebook with about five pages.

Depending on various conditions certain pages of the Notebook should not
be available at certain times.

The question therefore is how can I selectively disallow access to these
pages.

Thanks

Paul

___
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/