added eugtk examples
This commit is contained in:
45
eugtk/examples/test86.ex
Normal file
45
eugtk/examples/test86.ex
Normal file
@@ -0,0 +1,45 @@
|
||||
|
||||
-------------------------------------------------------------------------
|
||||
--# Resizing Images
|
||||
-- To load images at a different size than normal, load them into a
|
||||
-- GdkPixbuf, then create a GtkImage from that pixbuf.
|
||||
-------------------------------------------------------------------------
|
||||
|
||||
include GtkEngine.e
|
||||
|
||||
constant docs = `<u><b>Resized Image</b></u>
|
||||
Original size: 525 x 360 pixels
|
||||
Loaded as GdkPixbuf,
|
||||
with width of 150 pixels,
|
||||
HxW ratio retained.
|
||||
`
|
||||
constant win = create(GtkWindow,
|
||||
"size=200x100,border_width=10,position=1,$destroy=Quit")
|
||||
|
||||
constant panel = create(GtkBox,"orientation=VERTICAL")
|
||||
add(win,panel)
|
||||
|
||||
constant lbl = create(GtkLabel)
|
||||
set(lbl,"markup",docs)
|
||||
add(panel,lbl)
|
||||
|
||||
object pix = create(GdkPixbuf,"thumbnails/7300.jpg")
|
||||
pix = get(pix,"scale simple",150,100,1)
|
||||
|
||||
constant img = create(GtkImage,pix)
|
||||
set(img,"margin bottom",5)
|
||||
add(panel,img)
|
||||
|
||||
constant btn1 = create(GtkButton,"gtk-quit","Quit")
|
||||
pack(panel,-btn1)
|
||||
|
||||
show_all(win)
|
||||
main()
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user