WxBasic


wxBasic is a free software / open-source software, cross-platform BASIC interpreter. As it is based on syntax of the BASIC language, it is designed to be simple to learn and understand, and allow novice programmers to write applications for graphical environments like Windows and Linux with minimal effort. wxBasic is a bytecode based language, like Perl or Java. It is licensed under the LGPL, so proprietary software's source code can be linked against it.
It can create stand-alone executables by binding together source code with the interpreter. In contrast with executables created by similar commercial programs like Visual Basic, executables produced by wxBasic do not require any external DLL file, resource file, or installer to run. The executable is distributed alone and can be run immediately by end-users. As with programs written in any interpreted language, wxBasic programs may also be run straight from the source code on any platform, if wxBasic is present.
wxBasic is written primarily in C, with some C++ linking it to the wxWidgets library. wxWidgets supplies the cross-platform features. It runs on Microsoft Windows using native controls, and on Linux and macOS using the GTK+ library.

Example

The following program implements a text viewer:

' from http://wxbasic.sourceforge.net/phpBB2/viewtopic.php?t=554
' Simple Text Viewer written in wxBasic
dim AppName = "Text Viewer"
fileName = ""
' Main window
dim frame = new wxFrame
' Text edit control
dim control = new wxTextCtrl,
wxSize
' Status bar - The one at the bottom of the window
dim status = frame.CreateStatusBar
frame.SetStatusText
'
' Dialog used for Open
dim fileDialog = new wxFileDialog
'
' add menubar to the frame
dim mBar = new wxMenuBar
frame.SetMenuBar
'
' build the "File" dropdown menu
dim mFile = new wxMenu
mBar.Append
' make it
'
mFile.Append
'
mFile.AppendSeparator
mFile.Append
Sub onFileOpen
fileDialog.SetMessage
fileDialog.SetStyle
If fileDialog.ShowModal = wxID_OK Then
fileName = fileDialog.GetPath
Ext = fileDialog.GetFilename
control.Clear
control.LoadFile
frame.SetTitle
frame.SetStatusText
End If
End Sub
'
Connect
Sub onFileExit
frame.Close
End Sub
'
Connect
' build the "Help" dropdown menu
dim mHelp = new wxMenu
mBar.Append
mHelp.Append
'
Sub onHelpAbout
Dim msg = "Text View allows any text file\n" &
"to be viewed regardless of its extension.\n" &
"If the file being opened isn't a text file\n" &
"then it won't be displayed. There will be a\n" &
"little garbage shown and that's all."
wxMessageBox
End Sub
Connect
frame.Show