Skip to content

wx.NET Sample

rollynoel edited this page Jun 13, 2013 · 2 revisions

Added by dholton dholton

Here is sample boo code for using the wx.NET GUI framework. By Angel Ignacio Colmenares.

It requires wx-cc.dll and wx.NET.dll.

(Please check the indenting on this code if you run or alter it, it was just copied and pasted from Google.)

import wx from "wx.NET"
import System
import System.Drawing from System.Drawing

class myFrame(wx.Frame):

        def constructor(title as String, pos as Point, size as Size):

                super(null, title, pos, size)
                #Icon = wx.Icon("mondrian.png")

                fileMenu =  wx.Menu()
                fileMenu.Append(1, "E&xit\tAlt-X", "Quit this program")
                helpMenu =  wx.Menu()
                helpMenu.Append(2 , "&About...\tF1", "Show about dialog")

                EVT_MENU(1, OnQuit )
                EVT_MENU(2, OnAbout)

                menuBar =  wx.MenuBar()
                menuBar.Append(fileMenu, "&File")
                menuBar.Append(helpMenu, "&Help")

                MenuBar = menuBar

                CreateStatusBar(2)
                StatusText = "Welcome to wxWidgets!"

        def OnQuit(sender as object,  e as wx.Event)as void :
                Close()

        def OnAbout(sender as object, e as wx.Event) as  void:
                msg = "This is the About dialog of the minimal sample."
                wx.MessageDialog.ShowModal(self, msg, "About Minimal", Dialog.wxOK | Dialog.wxICON_INFORMATION)

class Minimal(wx.App):
        def OnInit():
                frame= myFrame("Hello boo + wx.NET", Point(50,50), Size(450,340))
                frame.Show(true)
                return true

class main():
        def constructor():
                app=Minimal()
                app.Run()

main() 
Clone this wiki locally