Page 1 of 1

This gtk code is definetly running.

PostPosted: Mon Jun 05, 2017 12:42 pm
by Achletomeniak
cobra-2.png
the cobra is biting
cobra-2.png (577.55 KiB) Viewed 569 times
This gtk code is running on cobra with mono linux. :mrgreen:

Code: Select all
@args -pkg:gtk-sharp-2.0

use Gtk

class ToggleButtons

    def main
        ToggleButtons().run

    def onDeleteEvent(obj, args as DeleteEventArgs)
        Application.quit

    def onExitButtonEvent(obj, args as EventArgs)
        Application.quit

    def run
        Application.init

        window = Window('Toggle Buttons')
        listen window.deleteEvent, ref .onDeleteEvent
        window.borderWidth = 0

        box1 = VBox(false, 10)
        window.add(box1)
        box1.show

        box2 = VBox(false, 10)
        box2.borderWidth = 10
        box1.packStart(box2, true, true, 0)
        box2.show

        toggleButt = ToggleButton('Button 1')
        box2.packStart(toggleButt, true, true, 0)
        toggleButt.show

        toggleButt = ToggleButton('Button 2')
        toggleButt.active = true
        box2.packStart(toggleButt, true, true, 0)
        toggleButt.show

        separator = HSeparator()
        box1.packStart(separator, false, true, 0)
        separator.show

        box3 = VBox(false, 10)
        box3.borderWidth = 10
        box1.packStart(box3, false, true, 0)

        button = Button('Close')
        listen button.clicked, ref .onExitButtonEvent

        box3.packStart(button, true, true, 0)
        button.canDefault = true
        button.grabDefault
        button.show

        window.showAll

        Application.run


Re: This gtk code is definetly running.

PostPosted: Mon Jun 05, 2017 1:25 pm
by Charles
Excellent!

Re: This gtk code is definetly running.

PostPosted: Tue Jun 06, 2017 4:37 am
by Achletomeniak
Hi again ,

i can start the compiled gtk.exe also on LINUX PC.

mono gtk.exe

and the widget will start.

the same as i type cobra gtk.cobra

What does that mean ?

Is this a real "check out" for the exe IF the .exe is running on windows by a double klick ?

WBR
Ach

Re: This gtk code is definetly running.

PostPosted: Tue Jun 06, 2017 4:17 pm
by Charles
"cobra gtk.cobra" will always compile to an .exe and then run it.

"mono gtk.exe" just runs the .exe file that is already there.

"cobra --compile-if-needed gtk.cobra" will compare the timestamp to the .exe and only compile if the .cobra is newer than the .exe.

You can also abbreviate that as "cobra -cin gtk.cobra"

See "cobra --help" for more info.

Re: This gtk code is definetly running.

PostPosted: Wed Jun 07, 2017 7:14 am
by Achletomeniak
Yeah.

Re: This gtk code is definetly running.

PostPosted: Thu Jun 08, 2017 9:32 am
by Charles
Interesting design. You might want to post that as a separate thread called "Cobra Wallpaper"