Forum: Ruby KixForm, a (little) GUI for Ruby / win ?

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Do Re Mi chel La Si Do (Guest)
on 2005-12-31 13:12
(Received via mailing list)
Hi!


I use Python, but, I read, from time to time, the news of the Ruby
cousin.


I had found (since only 2 hours) that KixForm can to do used by Python +
PyWin32.

But, that must adapt easily to Ruby.

At the end of the message, a very small example (in Python)

It's an Active-X, in one file (.DLL), and one help-file (.CHM)

It is limited, but simple

Download here :
  http://www.kixforms.org/assets/files/kixforms/KiXf...


@-salutations

Michel Claveau






# -*- coding: cp1252 -*-

import time
import win32com.client

kgui = win32com.client.Dispatch('Kixtart.System')

def rgb(r,g,b):
    return (r*256+g)*256+b

form=kgui.Form()
form.ClientSize=(520,220)
form.Font = "Verdana"
form.Text = "Titre de la fenêtre"

label = form.Controls.Label()
label.Font = "Verdana",
label.FontSize = 18
label.ForeColor = rgb(127,0,0)
label.FontBold = True
label.Text = "(vide)"
label.Top=40
label.Left=40
label.Size=(550,30)

bouton1= form.Controls.Button()
bouton1.Size=(80,30)
bouton1.Text="vraiment"
bouton1.Font = "Verdana",
bouton1.FontSize = 12
bouton1.OnClick="BT1"
bouton1.Left=20
bouton1.Top=100

bouton2= form.Controls.Button()
bouton2.Size=(80,30)
bouton2.Text="On"
bouton2.Font = "Verdana",
bouton2.FontSize = 12
bouton2.OnClick="BT2"
bouton2.Left=120
bouton2.Top=100

bouton3= form.Controls.Button()
bouton3.Size=(80,30)
bouton3.Text="a"
bouton3.Font = "Verdana",
bouton3.FontSize = 12
bouton3.OnClick="BT3"
bouton3.Left=220
bouton3.Top=100

bouton4= form.Controls.Button()
bouton4.Size=(80,30)
bouton4.Text="soif."
bouton4.Font = "Verdana",
bouton4.FontSize = 12
bouton4.OnClick="BT4"
bouton4.Left=320
bouton4.Top=100

bouton5= form.Controls.Button()
bouton5.Size=(80,30)
bouton5.Text="très"
bouton5.Font = "Verdana",
bouton5.FontSize = 12
bouton5.OnClick="BT5"
bouton5.Left=420
bouton5.Top=100

btquit= form.Controls.Button()
btquit.Size=(160,30)
btquit.Text="Terminer "
btquit.Font = "Verdana",
btquit.FontBold = True
btquit.FontItalic = True
btquit.FontSize = 18
btquit.OnClick="QUIT"
btquit.Top=170
btquit.Left=180


form.Show()
txt=''
while form.Visible:
    action=kgui.Application.DoEvents()
    if action=='BT1':    txt=txt+' '+bouton1.Text
    if action=='BT2':    txt=txt+' '+bouton2.Text
    if action=='BT3':    txt=txt+' '+bouton3.Text
    if action=='BT4':    txt=txt+' '+bouton4.Text
    if action=='BT5':    txt=txt+' '+bouton5.Text
    if action=="QUIT": break
    label.Text=txt
    time.sleep(0.5)

print 'Résultat :',label.Text
This topic is locked and can not be replied to.