Another game witk ‘tk’

Januari 26, 2008 at 1:39 pm (Apa aja deh, Open Source)

If somebody else and maybe all of you guys are playing ruby with Gtk2, i will play with ‘Tk’. I dont know the good reason to use this damn thing but just like my mum said….TRY IT !!…Maybe just because i do not find free e-book for Gtk Ruby :D

Just simple way using my paradise way :D

$sudo apt-get install libtk-ruby :-P

This library provides some widgets and container of course under tk its self..And this is my first code for tk..

$gedit cobagui.rb
class Aguilera

require ‘tk’ #kudu ada kode sakti ini untuk request module Tk

#Merupakan kode sakti juga. Kudu ada sintak ini untuk mendeklarasikan document root
top = TkRoot.new {title “Coba Label dan Entry Widget”}

#kode penambahan widget Label
lb1 = TkLabel.new(top){
text ‘Ini label Mbak…’
background “yellow”
foreground “blue”
pack(‘padx’=>10, ‘pady’=>10, ’side’=>’left’)
}

#kode penambahan widgets Entry
e1 = TkEntry.new(){
background “red”
foreground “black”
pack(‘padx’=>10, ‘pady’=>10, ’side’=>’left’)
}

list1 = TkListbox.new(top)
list1.insert(1,”Bakpao”)
list1.insert(2,”Ramen”)
list1.insert(3,”Pizza”)

list1.pack()
checkVar=TkVariable.new
c1 = TkCheckButton.new(top){
text “Klik sini jika Anda Lapar”
variable checkVar
pack()
}

Tk.mainloop

end

To good to be truth :D

rubyku.png

Hope i will be the last ruby bending (halah) from KLUWEK :D

1 Komentar

  1. Belutz berkata,

    ahahahahaha….
    itu aplikasinya buat pesen makanan dari jauh yah? :D

Tulis sebuah Komentar