Forums

This gtk code is definetly running.

General discussion about Cobra. Releases and general news will also be posted here.
Feel free to ask questions or just say "Hello".

This gtk code is definetly running.

Postby Achletomeniak » Mon Jun 05, 2017 12:42 pm

cobra-2.png
the cobra is biting
cobra-2.png (577.55 KiB) Viewed 89868 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

Achletomeniak
 

Re: This gtk code is definetly running.

Postby Charles » Mon Jun 05, 2017 1:25 pm

Excellent!
Charles
 
Posts: 2515
Location: Los Angeles, CA

Re: This gtk code is definetly running.

Postby Achletomeniak » Tue Jun 06, 2017 4:37 am

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
Achletomeniak
 

Re: This gtk code is definetly running.

Postby Charles » Tue Jun 06, 2017 4:17 pm

"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.
Charles
 
Posts: 2515
Location: Los Angeles, CA

Re: This gtk code is definetly running.

Postby Achletomeniak » Wed Jun 07, 2017 7:14 am

Yeah.
Attachments
cobra_wallpaper_by_ljdesigner-d6sjrfi2.jpg
Take advantage of cobra.
cobra_wallpaper_by_ljdesigner-d6sjrfi2.jpg (287.39 KiB) Viewed 89848 times
Achletomeniak
 

Re: This gtk code is definetly running.

Postby Charles » Thu Jun 08, 2017 9:32 am

Interesting design. You might want to post that as a separate thread called "Cobra Wallpaper"
Charles
 
Posts: 2515
Location: Los Angeles, CA


Return to Discussion

Who is online

Users browsing this forum: No registered users and 10 guests