Re: [pygtk] position in scrolled window

2003-02-15 Thread Abraham Egnor
I'm not sure if there's a canonical answer to this.  The way I've done
this is:

view = gtk.
scroller = gtk.ScrolledWindow()
scroller.add(view)
vadj = scroller.get_vadjustment()
vadj.connect('changed', lambda a, s=scroller: rescroll(a,s))

def rescroll(adj, scroll):
adj.set_value(adj.upper-adj.page_size)
scroll.set_vadjustment(adj)

That will always keep the scroller at the bottom; I also usually add a
check to see if the last position was at the bottom, so it only
autoscrolls if it was already all the way down - that way the user can
scroll back up and not be interrupted.

Abe

On Sat, 15 Feb 2003, Martijn Brouwer wrote:

> Hi, I have added a scrolled window to my application. I want it to
> display always the lowest part of the widget inside it (a gtk.textview).
> How can I achieve this? 
> 
> Bye,
> 
> Martijn
> 
> ___
> pygtk mailing list   [EMAIL PROTECTED]
> http://www.daa.com.au/mailman/listinfo/pygtk
> Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/
> 

___
pygtk mailing list   [EMAIL PROTECTED]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/



[pygtk] position in scrolled window

2003-02-15 Thread Martijn Brouwer
Hi,
I have added a scrolled window to my application. I want it to display always the 
lowest part of the widget inside it (a gtk.textview). How can I achieve this?

Bye,

Martijn

___
pygtk mailing list   [EMAIL PROTECTED]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/



Re: [pygtk] Draw rectangle with GDK

2003-02-15 Thread Martin Grimme
I would like know, if is it possble to use GDK with pygtk ?
If yes, then what is the syntax to use it ? example : how to draw 
rectangle in window ?

Maybe this example will help you:

import pygtk
pygtk.require("2.0")
import gtk


def on_expose(da, event, *args):

gdkwin = da.window
gc = gdkwin.new_gc()
gc.foreground = gdkwin.get_colormap().alloc_color("blue")
gdkwin.draw_rectangle(gc, gtk.TRUE, 10, 10, 100, 100)


win = gtk.Window()
win.show()
win.connect("delete-event", gtk.mainquit)

da = gtk.DrawingArea()
da.show()
win.add(da)
da.connect("expose-event", on_expose)

gtk.mainloop()


When a window has to redraw itself, it emits the "expose-event".
You use the event handler to do draw into the window.
You could also use an offscreen drawable and copy the pixmap into the
window when necessary. You can force a window to redraw itself (emit
the "expose-event") by calling the window method queue_redraw().
Don't put complex drawing operations into the event handler because they
will be performed each time the window has to redraw parts.


Bye, Martin Grimme -- http://www.pycage.de

___
pygtk mailing list   [EMAIL PROTECTED]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/



[pygtk] draw on TextView borders

2003-02-15 Thread Pier Carteri
Hi to all,
I would like to know if it's possible to draw somethings on TextView
borders. According with testtext example it can be done with the C
version of gtk but I can't undestand how to do it with pygtk. (with draw
I mean the possibility to  add small images or line numbers...)
Has anyone already done this? How?
Any tips or code example will be great

Thank you!

Pier Carteri



___
pygtk mailing list   [EMAIL PROTECTED]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/