ソース<isPrime.d>  完成版

        #メニューバーはなくしました。


import "GUI"
import "math"

w = gui.window("IsPrime",[0,0,239,319])

l1 = gui.label(w, "Input Number!", [15,5,100,25])
e1 = gui.edit(w, "", [100,3,200,25])
b1 = gui.button(w, "Check!", [15,35,200,65])
p1 = gui.pane(w, [15,70,200,180])
p1.OnPaint=func()
    p1.Pen={width:3, color:[255, 0, 0]}
    p1.Font={name:"Arial", size:700}
    p1.DrawText(65,0,"?")
endfunc
p1.Repaint()

isPrime = func(x)
    If x<2 Then Return false
    EndIf

    en=Int( math.sqrt(x) )
    r=true

    For i=2 To en
        IF x-Int(x/i)*i=0 Then 
            r=false
        EndIf
    EndFor
    If r=false Then Return false
    Else Return true
    EndIf 
endfunc

b1.OnClick=func()
    i=Int(e1.Text)
    If isprime(i) Then
        p1.OnPaint=func()
            p1.Pen={width:3, color:[255, 0, 0]}
            p1.Font={name:"Arial", size:700}
            p1.DrawText(65,0,"O")
        endfunc
        p1.Repaint()
    Else
        p1.OnPaint=func()
            p1.Pen={width:3, color:[255, 0, 0]}
            p1.Font={name:"Arial", size:700}
            p1.DrawText(65,0,"X")
        endfunc
        p1.Repaint()
    EndIf
endfunc

e1.OnFocus = func()
    p1.OnPaint=func()
        p1.Pen={width:3, color:[255, 0, 0]}
        p1.Font={name:"Arial", size:700}
        p1.DrawText(65,0,"?")
    endfunc
    p1.Repaint()
endfunc

gui.enter()


もどる