Hello world/Graphical: Difference between revisions
Added Vim Script solution
m (→{{header|EchoLisp}}: Corrected Goodbye, World! phrase to match the task.) |
(Added Vim Script solution) |
||
(48 intermediate revisions by 31 users not shown) | |||
Line 14:
=={{header|AArch64 Assembly}}==
{{works with|as|Raspberry Pi 3B version Buster 64 bits}}
<syntaxhighlight lang="aarch64 assembly">
/* ARM assembly AARCH64 Raspberry PI 3B */
/* program disMessGraph64.s */
Line 225:
.include "../includeARM64.inc"
</syntaxhighlight>
=={{header|Action!}}==
<syntaxhighlight lang="action!">DEFINE PTR="CARD"
BYTE FUNC AtasciiToInternal(CHAR c)
BYTE c2
c2=c&$7F
IF c2<32 THEN
RETURN (c+64)
ELSEIF c2<96 THEN
RETURN (c-32)
FI
RETURN (c)
PROC CharOut(CARD x BYTE y CHAR c)
BYTE i,j,v
PTR addr
addr=$E000+AtasciiToInternal(c)*8;
FOR j=0 TO 7
DO
v=Peek(addr)
i=8
WHILE i>0
DO
IF (v&1)=0 THEN
Color=0
ELSE
Color=1
FI
Plot(x+i-1,y+j)
v=v RSH 1
i==-1
OD
addr==+1
OD
RETURN
PROC TextOut(CARD x BYTE y CHAR ARRAY text)
BYTE i
FOR i=1 TO text(0)
DO
CharOut(x,y,text(i))
x==+8
OD
RETURN
PROC Frame(CARD x BYTE y,width,height)
Color=1
Plot(x,y)
DrawTo(x+width-1,y)
DrawTo(x+width-1,y+height-1)
DrawTo(x,y+height-1)
DrawTo(x,y)
RETURN
PROC Main()
BYTE CH=$02FC,COLOR1=$02C5,COLOR2=$02C6
BYTE i,x,y,width=[122],height=[10]
Graphics(8+16)
COLOR1=$0C
COLOR2=$02
FOR i=1 TO 10
DO
x=Rand(320-width)
y=Rand(192-height)
Frame(x,y,width,height)
TextOut(x+1,y+1,"Goodbye, World!")
OD
DO UNTIL CH#$FF OD
CH=$FF
RETURN</syntaxhighlight>
{{out}}
[https://gitlab.com/amarok8bit/action-rosetta-code/-/raw/master/images/Hello_world_graphical.png Screenshot from Atari 8-bit computer]
=={{header|ActionScript}}==
<
var textField:TextField = new TextField();
stage.addChild(textField);
textField.text = "Goodbye, World!"
</syntaxhighlight>
=={{header|Ada}}==
{{libheader|GTK|GtkAda}}
{{libheader|GtkAda}}
<
with Gtk.Label; use Gtk.Label;
with Gtk.Window; use Gtk.Window;
Line 283 ⟶ 363:
Gtk.Main.Main;
end Windowed_Goodbye_World;</
=={{header|ALGOL 68}}==
The code below is a gentle re-write (including a bug fix) of that in
the Algol 68 Genie documentation.
<
BEGIN
FILE window;
Line 300 ⟶ 380:
close (window)
END
</syntaxhighlight>
[[Category:ALGOL 68#ALGOL 68]]
Line 313 ⟶ 393:
set Screen1.Title to "Goodbye World!"<br>
[https://lh6.googleusercontent.com/-0MGq3ZZTgT8/UuwF5KBd7-I/AAAAAAAAJ-c/HirntN5II9g/s1600/blocks.PNG VIEW THE BLOCKS AND ANDROID APP SCREEN]
=={{header|APL}}==
See [http://rosettacode.org/wiki/Simple_windowed_application Simple Windowed Application]
=={{header|AppleScript}}==
<
=={{header|Applesoft BASIC}}==
<
2 LET R = 5:GX = 3:GY = 2:O = 3:XC = R + GX:YC = R * 2 + GY
3 TEXT : HOME : TEXT : HGR : HCOLOR= 7: HPLOT 0,0: CALL 62454: HCOLOR= 6
Line 353 ⟶ 436:
108 HPLOT XC - R,YC - R * 2 TO XC - R,YC + R: GOTO 9: REM L
114 HPLOT XC - R,YC - R TO XC - R,YC + R:O = 2: GOTO 10: REM R
121 HPLOT XC - R,YC - R TO XC,YC + R: HPLOT XC + R,YC - R TO XC - R,YC + R * 3: RETURN : REM Y</
=={{header|Arendelle}}==
Line 382 ⟶ 465:
// done</pre>
=={{header|Arturo}}==
<syntaxhighlight lang="rebol">popup "" "Goodbye, World!"</syntaxhighlight>
{{out}}
Here, you can see what the [https://i.ibb.co/Y35c1Wc/Screenshot-2022-05-13-at-10-57-16.png popup box with our message] looks like (on macOS).
=={{header|ATS}}==
<syntaxhighlight lang="ats">//
#include
"share/atspre_define.hats"
Line 484 ⟶ 575:
val ((*void*)) = gtk_main ()
//
} (* end of [main0] *)</
=={{header|AutoHotkey}}==
<syntaxhighlight lang
<syntaxhighlight lang
<
Gui, Add, Edit, xp+90 yp-3, Goodbye, World!
Gui, Add, Button, xp+98 yp-1, OK
Gui, Show, w226 h22 , Rosetta Code
Return</
<
=={{header|AutoHotKey V2}}==
<syntaxhighlight lang="autohotkey">
MsgBox("Goodbye, World!")
</syntaxhighlight>
=={{header|AutoIt}}==
<
$hGUI = GUICreate("Hello World") ; Create the main GUI
Line 513 ⟶ 609:
EndSwitch
WEnd
</syntaxhighlight>
<
<
=={{header|AWK}}==
Line 527 ⟶ 623:
and [[Hello_world/Graphical#UNIX_Shell|UNIX_Shell]].
<
BEGIN { system("msg * Goodbye, Msgbox !") }
</syntaxhighlight>
=={{header|Axe}}==
This example is almost identical to the [[#TI-83_BASIC|TI-83 BASIC version]].
<
Text(0,0,"Goodbye, world!")
Pause 5000</
=={{header|BaCon}}==
Using Xaw backend:
<
gui = GUIDEFINE("{ type=window name=window XtNtitle=\"Graphical\" } \
{ type=labelWidgetClass name=label parent=window XtNlabel=\"Goodbye, World!\" } ")
CALL GUIEVENT$(gui)</
Using GTK3 backend:
<
PRAGMA GUI gtk3
Line 553 ⟶ 649:
{ type=LABEL name=label parent=window margin=5 label=\"Goodbye, World!\" } ")
CALL GUIEVENT$(gui)</
=={{header|BASIC}}==
{{works with|FreeBASIC}}
<
#include once "windows.bi"
Line 573 ⟶ 669:
MessageBox(NULL, "Goodbye World", "Goodbye World", MB_ICONINFORMATION)
function = 0
End Function</
<
#INCLUDE "gtk/gtk.bi"
Line 588 ⟶ 684:
gtk_main()
END 0</
=={{header|BASIC256}}==
<syntaxhighlight lang="basic256">clg
font "times new roman", 20,100
color orange
rect 10,10, 140,30
color red
text 10,10, "Goodbye, World!"</
=={{header|batari Basic}}==
<
................................
................................
Line 617 ⟶ 713:
drawscreen
goto mainloop
</syntaxhighlight>
=={{header|Batch File}}==
From Window 7 and later, pure Batch File does not completely provide GUI. However, <code>MSHTA.EXE</code> provides command-line JavaScript/VBScript access.
<
::Output to message box [Does not work in Window 7 and later]
Line 629 ⟶ 725:
@mshta javascript:alert("Goodbye, World!");code(close());
@mshta vbscript:Execute("msgbox(""Goodbye, World!""):code close")
pause</
=={{header|BBC BASIC}}==
{{works with|BBC BASIC for Windows}}
<
=={{header|Beads}}==
Beads specializes in graphical design and can use draw_str for html in the browser or alerts for popup boxes.
<
calc main_init
alert('Goodbye, World!')
draw main_draw
draw_str('Goodbye, World!')</
=={{header|BML}}==
<syntaxhighlight lang
=={{header|C}}==
=== GTK ===
{{libheader|GTK}}
<
int main (int argc, char **argv) {
Line 663 ⟶ 759:
gtk_main();
return 0;
}</
=== Win32 ===
Line 671 ⟶ 767:
To compile with Visual C++: <code>cl /nologo hello.c user32.lib</code>, or with Open Watcom: <code>wcl386 /q hello.c user32.lib</code>.
<
int main(void) {
MessageBox(NULL, TEXT("Goodbye, World!"), TEXT("Rosetta Code"), MB_OK | MB_ICONINFORMATION);
return 0;
}</
=== OS/2 Presentation Manager ===
Line 687 ⟶ 783:
wlink system os2v2_pm name hello file hello.obj</pre>
<
int main(void) {
Line 706 ⟶ 802:
WinTerminate(hab);
return 0;
}</
=== Turbo C for DOS ===
Line 712 ⟶ 808:
Using the graphics library included with Turbo C. The BGI driver and the font must be in the same directory as the program (<code>EGAVGA.BGI</code> and <code>SANS.CHR</code>). Compile with <code>tcc hellobgi.c graphics.lib</code>.
<
#include <graphics.h>
Line 734 ⟶ 830:
closegraph();
return 0;
}</
=={{header|C sharp|C#}}==
Line 740 ⟶ 836:
{{libheader|Windows Forms}}
<
using System.Windows.Forms;
Line 748 ⟶ 844:
MessageBox.Show("Goodbye, World!");
}
}</
{{libheader|GTK}}
<
using GtkSharp;
Line 763 ⟶ 859:
Application.Run();
}
}</
=={{header|C++}}==
Line 769 ⟶ 865:
{{libheader|GTK}}<!-- c++ bindings -->
<
int main(int argc, char *argv[])
{
Line 775 ⟶ 871:
Gtk::MessageDialog msg("Goodbye, World!");
msg.run();
}</
{{libheader|Win32}}
All Win32 APIs work in C++ the same way as they do in C. See the C example.
Line 781 ⟶ 877:
{{libheader|MFC}}
Where pWnd is a pointer to a CWnd object corresponding to a valid window in the application.
<
void ShowGoodbyeWorld(CWnd* pWnd)
{
pWnd->SetWindowText(_T("Goodbye, World!"));
}</
{{libheader|FLTK}}
<
#include <FL/Fl.H>
#include <FL/Fl_Window.H>
Line 805 ⟶ 901:
return Fl::run();
}
</syntaxhighlight>
=={{header|C++/CLI}}==
<
using namespace System::Windows::Forms;
Line 816 ⟶ 912:
return 0;
}
</syntaxhighlight>
=={{header|Casio BASIC}}==
To configure the "Graphical screen"
<
AxesOff
CoordOff
GridOff
LabelOff</
ViewWindow parameters depend on the calculator resolution (These are the most common). <br>
To print text on the "Graphical screen" of the calculator:
<
ClrGraph</
=={{header|Clean}}==
{{libheader|Object I/O}}
<
Start :: *World -> *World
Line 838 ⟶ 934:
where
hello = Dialog "" (TextControl "Goodbye, World!" [])
[WindowClose (noLS closeProcess)]</
=={{header|Clojure}}==
<
(:import (javax.swing JOptionPane JFrame JTextArea JButton)
(java.awt FlowLayout)))
Line 855 ⟶ 951:
(.pack)
(.setDefaultCloseOperation (JFrame/EXIT_ON_CLOSE))
(.setVisible true)))</
=== With cljfx ===
{{libheader|cljfx}}
<
(:require [cljfx.api :as fx]))
Line 873 ⟶ 969:
:alignment :center
:children [{:fx/type :label
:text "Goodbye, world"}]}}}))</
=={{header|COBOL}}==
Line 882 ⟶ 978:
{{libheader|Windows Forms}}
{{trans|C#}}
<
METHOD-ID Main STATIC.
PROCEDURE DIVISION.
Line 888 ⟶ 984:
INVOKE TYPE MessageBox::Show("Goodbye, World!")
END METHOD.
END CLASS.</
{{libheader|Windows Presentation Foundation}}
gui.xaml.cbl:
<
INHERITS TYPE System.Windows.Window.
METHOD-ID NEW.
Line 898 ⟶ 994:
INVOKE self::InitializeComponent()
END METHOD.
END CLASS.</
gui.xaml:
<
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="Hello world/Graphical">
<TextBox>Goodbye, World!</TextBox>
</Window></
===GTK===
{{works with|GnuCOBOL|2.0}}
{{libheader|cobweb-gtk}}
<
*> cobweb-gui-hello, using gtk-label
*> Tectonics:
Line 972 ⟶ 1,068:
goback.
end program cobweb-gui-hello.</
===TUI===
Line 979 ⟶ 1,075:
The program gets the lines and columns of the screen and positions the text in the middle. Program waits for a return key.
<
data division.
working-storage section.
Line 997 ⟶ 1,093:
end-display
accept var end-accept
stop run.</
=={{header|Cobra}}==
Line 1,003 ⟶ 1,099:
Requires {{libheader|GTK#}} GUI library.
<
@args -pkg:gtk-sharp-2.0
Line 1,018 ⟶ 1,114:
dialog.run
dialog.destroy
</syntaxhighlight>
=={{header|CoffeeScript}}==
<
=={{header|Commodore BASIC}}==
Line 1,031 ⟶ 1,127:
The POKE statements encapsulating the text drawing routine (lines 410-415 and 450-455) are necessary to make the Character ROM visible to BASIC without crashing the operating system. As such, keyboard scanning must be suspended during this time, preventing the routine from any user interruption until it is finished.
<syntaxhighlight lang="commodorebasicv2">
1 rem hello world on graphics screen
2 rem commodore 64 version
Line 1,081 ⟶ 1,177:
530 poke mem,peek(mem) or 2^px
540 return
</
Line 1,087 ⟶ 1,183:
This can be done using the extension package ''ltk'' that provides an interface to the ''Tk'' library.
{{libheader|Tk}}
<
(defun show-message (text)
Line 1,101 ⟶ 1,197:
(mainloop))))
(show-message "Goodbye World")</
This can also be done using the ''CLIM 2.0'' specification. The following code runs on both SBCL and the LispWorks
IDE:
{{libheader|CLIM}}
<
(in-package :clim-user)
Line 1,134 ⟶ 1,230:
(run-frame-top-level
(make-application-frame 'hello-world
:width 200 :height 200))</
=={{header|Creative Basic}}==
<syntaxhighlight lang="creative basic">
DEF Win:WINDOW
DEF Close:CHAR
Line 1,160 ⟶ 1,256:
RETURN
</syntaxhighlight>
=={{header|Crystal}}==
{{libheader|CrSFML}}
<syntaxhighlight lang="crystal">
require "crsfml"
window = SF::RenderWindow.new(SF::VideoMode.new(800, 600), "Hello world/Graphical")
# A font file(s) MUST be in the directory of the Crystal file itself.
# CrSFML does NOT load font files from the filesystem root!
font = SF::Font.from_file("DejaVuSerif-Bold.ttf")
text = SF::Text.new
text.font = font
text.string = "Goodbye, world!"
text.character_size = 24
text.color = SF::Color::Black
while window.open?
while event = window.poll_event
if event.is_a? SF::Event::Closed
window.close
end
end
window.clear(SF::Color::White)
window.draw(text)
window.display
end
</syntaxhighlight>
=={{header|D}}==
{{libheader|gtkD}}
<
class GoodbyeWorld : MainWindow {
Line 1,178 ⟶ 1,310:
new GoodbyeWorld();
Main.run();
}</
=={{header|Dart}}==
Line 1,186 ⟶ 1,318:
Simplest (and ugliest) solution
<
main() => runApp( MaterialApp( home: Text( "Goodbye, World!" ) ) );
</syntaxhighlight>
A still bare bones but much better looking example that displays a white screen with the text centered
<
void main() {
Line 1,206 ⟶ 1,338:
);
}
</syntaxhighlight>
Line 1,213 ⟶ 1,345:
===Web/Javascript===
{{libheader|dart:html}}
<
main() => document.body.innerHtml = '<p>Goodbye, World!</p>';
</syntaxhighlight>
{{trans|JavaScript}}
<
main() => window.alert("Goodbye, World!");
</syntaxhighlight>
=={{header|Delphi}}==
<
uses
Line 1,232 ⟶ 1,364:
begin
ShowMessage('Goodbye, World!');
end.</
=={{header|Diego}}==
To differentiate only a GUI message use the <code>display_</code> verb.
<syntaxhighlight lang="diego">display_me()_msg(Goodbye, World!);</syntaxhighlight>
However, using the <code>_msg</code> (short for 'message') action will send a string message to the callee who may decide to display the string graphically...
<syntaxhighlight lang="diego">me_msg(Goodbye, World!);</syntaxhighlight>
=={{header|Dylan}}==
(This works entered into the interactive shell):
<
=={{header|E}}==
Line 1,244 ⟶ 1,382:
This is a complete application. If it were part of a larger application, the portions related to <code>interp</code> would be removed.
<
def SWT := <swt:makeSWT>
Line 1,260 ⟶ 1,398:
frame.open()
interp.blockAtTop()</
=={{header|EasyLang}}==
[https://easylang.
<syntaxhighlight lang="text">
move 10 20
text "Goodbye, World!"
</syntaxhighlight>
=={{header|eC}}==
MessageBox:
<
MessageBox goodBye { contents = "Goodbye, World!" };</
Label:
<
Label label { text = "Goodbye, World!", hasClose = true, opacity = 1, size = { 320, 200 } };</
Titled Form + Surface Output:
<
class GoodByeForm : Window
Line 1,296 ⟶ 1,436:
}
GoodByeForm form {};</
=={{header|EchoLisp}}==
<
(alert "Goodbye, World!")
</syntaxhighlight>
=={{header|EGL}}==
{{works with|EDT}}
Allows entry of any name into a text field (using "World" as the default entry). Then, when the "Say Goodbye" button is pressed, sets a text label to the value "Goodbye, <name>!".
<
import org.eclipse.edt.rui.widgets.*;
import dojo.widgets.*;
Line 1,323 ⟶ 1,463:
end
</syntaxhighlight>
=={{header|Elena}}==
ELENA
<
public class MainWindow : SDIDialog
Line 1,335 ⟶ 1,475:
constructor new()
<= super new()
{
self.Caption := "ELENA";
Line 1,355 ⟶ 1,495:
closeButton.onClick := (args){ forward program.stop() };
}
}</
=== Alternative version using xforms script ===
<
const layout = "
Line 1,384 ⟶ 1,524:
dispatch() => Form;
}</
=={{header|Emacs Lisp}}==
<syntaxhighlight lang="lisp">
(message-box "Goodbye, World!")
</syntaxhighlight>
=={{header|Euphoria}}==
===Message box===
<
integer response
response = message_box("Goodbye, World!","Bye",MB_OK)</
=={{header|F_Sharp|F#}}==
Just display the text in a message box.
<
open System
open System.Windows.Forms
Line 1,401 ⟶ 1,547:
let main _ =
MessageBox.Show("Hello World!") |> ignore
0</
=={{header|Factor}}==
Line 1,409 ⟶ 1,555:
=={{header|Fantom}}==
<
using fwt
Line 1,419 ⟶ 1,565:
}
}
</syntaxhighlight>
=={{header|Fennel}}==
{{libheader|LÖVE}}
<syntaxhighlight lang="fennel">
(fn love.load []
(love.window.setMode 300 300 {"resizable" false})
(love.window.setTitle "Hello world/Graphical in Fennel!"))
(let [str "Goodbye, World!"]
(fn love.draw []
(love.graphics.print str 95 150)))
</syntaxhighlight>
To run this, you need to have LÖVE installed in your machine, and then run this command <code>fennel --compile love_test.fnl > main.lua; love .</code>. Since LÖVE has no compatibility with Fennel, we need to AOT-compile the file to a Lua file called <code>main.lua</code>, so then LÖVE can execute the program.
=={{header|Forth}}==
Line 1,425 ⟶ 1,584:
{{works with|SwiftForth}}
<
Alternative:
{{works with|Win32Forth|6.15.03}}
<
=={{header|Fortran}}==
Line 1,437 ⟶ 1,596:
{{works with|Absoft Pro Fortran}}
<
use windows
integer :: res
res = MessageBoxA(0, LOC("Hello, World"), LOC("Window Title"), MB_OK)
end program</
Compile with <code>af90 hello.f90 user32.lib</code> or for a 64-bit executable <code>af90 -i8 -m64 hello.f90 user32.lib</code>.
{{works with|Intel Fortran}}
<
use user32
integer :: res
res = MessageBox(0, "Hello, World", "Window Title", MB_OK)
end program</
Compile with <code>ifort hello.f90</code>.
Line 1,457 ⟶ 1,616:
Using [https://github.com/jerryd/gtk-fortran gtk-fortran] library
{{works with|GNU Fortran}}
<
module handlers_m
use iso_c_binding
Line 1,498 ⟶ 1,657:
end program test
</syntaxhighlight>
Compile with
<code>gfortran gtk2_mini.f90 -o gtk2_mini.x `pkg-config --cflags --libs gtk-2-fortran`</code>
=={{header|FreeBASIC}}==
'''Graphics Mode'''
{{works with|QBasic}}
<syntaxhighlight lang="freebasic">screen 1 'Mode 320x200
locate 12,15
? "Goodbye, World!"
sleep</
'''Windows API'''
<
MessageBox(0, "Goodbye, World!", "Message",0)</
=={{header|Frege}}==
<
import Java.Swing
Line 1,538 ⟶ 1,687:
cp.add label
frame.pack
frame.setVisible true</
=={{header|Frink}}==
Line 1,547 ⟶ 1,696:
The graphics are infinitely-scalable and can be rendered at full quality to any resolution. This program "shows off" by rotating the text by 10 degrees, and also rendering it to a printer (which can include tiling across multiple pages) and rendering to a graphics file. (Frink can automatically render the same graphics object to many image formats, including PNG, JPG, SVG, HTML5 canvas, animated GIF, bitmapped image in memory, and more.)
<
g = new graphics
g.font["SansSerif", 10]
Line 1,555 ⟶ 1,704:
g.print[] // Optional: render to printer
g.write["GoodbyeWorld.png", 400, 300] // Optional: write to graphics file
</syntaxhighlight>
=={{header|FunL}}==
<
native java.awt.Font
Line 1,574 ⟶ 1,723:
f.setVisible( true )
SwingUtilities.invokeLater( createAndShowGUI.runnable('Goodbye, World!') )</
=={{header|FutureBasic}}==
Easy peasy.
<syntaxhighlight lang="futurebasic">
alert 1, NSWarningAlertStyle, @"Goodbye, World!", @"It's been real.", @"See ya!", YES
HandleEvents
</syntaxhighlight>
=={{header|Gambas}}==
<
=={{header|Genie}}==
<
/*
Genie GTK+ hello
Line 1,597 ⟶ 1,757:
window.show_all()
window.destroy.connect(Gtk.main_quit)
Gtk.main()</
=={{header|GlovePIE}}==
The text is rendered using Braille text characters.
<
=={{header|GML}}==
<
=={{header|Go}}==
{{libheader|go-gtk}}
<
import "github.com/mattn/go-gtk/gtk"
Line 1,623 ⟶ 1,783:
win.ShowAll()
gtk.Main()
}</
=={{header|Groovy}}==
{{trans|Java}}
<
import javax.swing.JFrame
Line 1,638 ⟶ 1,798:
}
}
</syntaxhighlight>
=={{header|GUISS}}==
Line 1,644 ⟶ 1,804:
Here we display the message on the system notepad:
<
=={{header|Harbour}}==
<
RETURN wapi_MessageBox(,"Goodbye, World!","")
</syntaxhighlight>
=={{header|Haskell}}==
Using {{libheader|gtk}} from [http://hackage.haskell.org/packages/hackage.html HackageDB]
<
import Control.Monad
Line 1,665 ⟶ 1,825:
dialog `onDestroy` mainQuit
mainGUI</
Run in GHCi interpreter:
<syntaxhighlight lang
=={{header|HicEst}}==
<
=={{header|HolyC}}==
<
== Icon and Unicon ==
==={{header|Icon}}===
<
procedure main()
WOpen("size=100,20") | stop("No window")
WWrites("Goodbye, World!")
WDone()
end</
{{libheader|Icon Programming Library}}
[http://www.cs.arizona.edu/icon/library/src/gprocs/graphics.icn graphics is required ]
Line 1,689 ⟶ 1,849:
==={{header|Unicon}}===
<
import gui
$include "guih.icn"
Line 1,711 ⟶ 1,871:
w.show_modal ()
end
</syntaxhighlight>
=={{header|HPPPL}}==
With an alert box:
<
By drawing directly to the screen:
<
TEXTOUT_P("Goodbye, World!", GROBW_P(G0)/4, GROBH_P(G0)/4, 7);
WAIT(-1);</
=={{header|i}}==
<
display("Goodbye, World!")
}</
=={{header|Integer BASIC}}==
Line 1,730 ⟶ 1,890:
40×40 isn't great resolution, but it's enough!
<
10 REM FONT DERIVED FROM 04B-09 BY YUJI OSHIMOTO
20 GR
Line 1,798 ⟶ 1,958:
660 VLIN 32,33 AT 33 : VLIN 32,33 AT 34
670 END
</syntaxhighlight>
=={{header|Ioke}}==
{{trans|Java}}
<
:javax:swing, :JOptionPane, :JFrame, :JTextArea, :JButton
)
Line 1,817 ⟶ 1,977:
setDefaultCloseOperation(JFrame field:EXIT_ON_CLOSE)
visible = true
)</
=={{header|IWBASIC}}==
<syntaxhighlight lang="iwbasic">
DEF Win:WINDOW
DEF Close:CHAR
Line 1,844 ⟶ 2,004:
RETURN
ENDSUB
</syntaxhighlight>
=={{header|J}}==
<syntaxhighlight lang
=={{header|Java}}==
{{libheader|Swing}}
<
import java.awt.*;
Line 1,874 ⟶ 2,034:
});
}
}</
Using Java 8 lambdas syntax:
<
import java.awt.*;
Line 1,898 ⟶ 2,058:
});
}
}</
=={{header|JavaScript}}==
<
=={{header|jq}}==
Line 1,914 ⟶ 2,074:
'''Part 1: Generic SVG-related functions'''
<
# e.g: "font-size: 40px; text-align: center;" (without the quotation marks)
def to_s:
Line 1,948 ⟶ 2,108:
| "<text x='\(x//0)' y='\(y//0)' style='\($style)'>
\(.)",
"</text>";</
'''Part 2: "Goodbye, World!"'''
<
svg(null;null), # use the defaults
linearGradient("gradient"; "rgb(255,255,0)"; "rgb(255,0,0)"), # define "gradient"
Line 1,956 ⟶ 2,116:
"</svg>";
task</
{{out}}
jq -n -r -f Hello_word_Graphical.jq > Hello_word_Graphical.svg
=={{header|JSE}}==
<syntaxhighlight lang="jse">Text 25,10,"Goodbye, World!"</syntaxhighlight>
=={{header|Jsish}}==
Line 1,973 ⟶ 2,136:
That is based on JSI CData, a blend of typed Javascript and C, interwoven via a preprocessor.
<
/*
Alert popup, via libAgar and Jsish CData
Line 2,015 ⟶ 2,178:
return rc;
}
};</
Build rules are ''jsish -c'' preprocessor, query ''jsish'' for C compile time flags, compile the C, load the module into jsish via ''require''.
Line 2,052 ⟶ 2,215:
{{libheader|Tk}}
<
window = Toplevel("Hello World", 200, 100, false)
Line 2,065 ⟶ 2,228:
set_visible(window, true)
# sleep(7)</
=={{header|Just Basic}}==
<syntaxhighlight lang="just basic">
print "Goodbye, World!"
'Prints in the upper left corner of the default text window: mainwin, a window with scroll bars.
</syntaxhighlight>
=={{header|KonsolScript}}==
Popping a dialog-box.
<
Konsol:Message("Goodbye, World!", "")
}</
Displaying it in a Window.
<
Screen:PrintString("Goodbye, World!")
while (B1 == false) {
Screen:Render()
}
}</
=={{header|Kotlin}}==
{{trans|Java}}
{{libheader|Swing}}
<
import javax.swing.*
Line 2,103 ⟶ 2,266:
isVisible = true
}
}</
=={{header|LabVIEW}}==
{{VI solution|LabVIEW_Hello_world_Graphical.png}}
=={{header|Lambdatalk}}==
<syntaxhighlight lang="scheme">
1) we add a new "alert" primitive to the lambdatalk's dictionary
{script
LAMBDATALK.DICT["alert"] = function() {
var args = arguments[0];
alert( args )
};
}
2) and we call it
{alert GoodBye World}
-> display a standard Alert WIndow.
</syntaxhighlight>
=={{header|Lasso}}==
On OS X machines:
<
=={{header|Liberty BASIC}}==
<
=={{header|Lingo}}==
Display in alert box:
<
Display in main window ("stage"):
<
m = new(#field)
m.rect = rect(0,0,320,240)
Line 2,135 ⟶ 2,315:
-- force immediate update
_movie.updateStage()</
=={{header|
Works in HyperCard and other xTalk environments
<syntaxhighlight lang="hypertalk"> answer "Goodbye, World!"</syntaxhighlight>
A dialog box can be modified as appropriate for the context by setting a "iconType", button text and title
<
=={{header|Lobster}}==
<
gl_setfontname("data/fonts/Droid_Sans/DroidSans.ttf")
gl_setfontsize(30)
Line 2,149 ⟶ 2,330:
while gl_frame():
gl_clear([ 0.0, 0.0, 0.0, 1.0 ])
gl_text("Goodbye, World!")</
=={{header|Logo}}==
Line 2,155 ⟶ 2,336:
Among the turtle commands are some commands for drawing text in the graphical area. Details and capabilities differ among Logo implementations.
<
SETLABELHEIGHT 2 * last LABELSIZE
LABEL [Goodbye, World!]</
=={{header|Lua}}==
==={{libheader|IUPLua}}===
<
dlg = iup.dialog{iup.label{title="Goodbye, World!"}; title="test"}
Line 2,168 ⟶ 2,349:
if (not iup.MainLoopLevel or iup.MainLoopLevel()==0) then
iup.MainLoop()
end</
==={{libheader|LÖVE}}===
Line 2,181 ⟶ 2,362:
or a shortcut to love.exe.
<
function love.draw()
love.graphics.print("Goodbye, World!", 400, 300)
end
</syntaxhighlight>
=={{header|M2000 Interpreter}}==
A window with a click event to open a message box, and print returned number to window form, scrolling at the lower part of form's layer.
<syntaxhighlight lang="m2000 interpreter">
Module CheckIt {
Declare Simple Form
Line 2,217 ⟶ 2,398:
}
CheckIt
</syntaxhighlight>
A simple Window only
<syntaxhighlight lang="m2000 interpreter">
Module CheckIt {
Declare Simple Form
Line 2,228 ⟶ 2,409:
}
CheckIt
</syntaxhighlight>
=={{header|Maple}}==
<syntaxhighlight lang="maple">
Maplets:-Display( Maplets:-Elements:-Maplet( [ "Goodbye, World!" ] ) );
</syntaxhighlight>
=={{header|Mathematica}} / {{header|Wolfram Language}}==
<
=={{header|MATLAB}}==
<syntaxhighlight lang
Add text to a graphical plot.
<
=={{header|MAXScript}}==
<
=={{header|MiniScript}}==
This implementation is for use with the [http://miniscript.org/MiniMicro Mini Micro] version of MiniScript.
<syntaxhighlight lang="miniscript">
import "textUtil"
hello = textUtil.Dialog.make("Hello, World Dialog", "Hello, World!")
hello.show
</syntaxhighlight>
=={{header|mIRC Scripting Language}}==
<
dialog -m Goodbye Goodbye
}
Line 2,258 ⟶ 2,448:
option dbu
text "Goodbye, World!", 1, 20 6 41 7
}</
=={{header|Modula-3}}==
{{libheader|Trestle}}
<
IMPORT TextVBT, Trestle;
Line 2,273 ⟶ 2,463:
Trestle.Install(v);
Trestle.AwaitDelete(v);
END GUIHello.</
This code requires an m3makefile.
<pre>
Line 2,291 ⟶ 2,481:
{{works with|All implementations of TROFF}}
<syntaxhighlight lang
=={{header|Neko}}==
The NekoVM uses a C FFI that requires marshaling of C types to Neko ''value'' types.
{{libheader|Agar}}
<
Tectonics:
gcc -shared -fPIC -o nekoagar.ndll nekoagar.c `agar-config --cflags --libs`
Line 2,412 ⟶ 2,602:
return alloc_int(rc);
}
DEFINE_PRIM(agar_eventloop, 0);</
The C file above is used to create a Neko friendly Dynamic Shared Object file, nekoagar.ndll.
Line 2,419 ⟶ 2,609:
The Neko program follows:
<syntaxhighlight lang="actionscript">/**
<doc><pre>
Hello world, graphical, in Neko, via Agar label
Line 2,452 ⟶ 2,642:
/* Run the event loop */
agar_eventloop();</
{{out}}
Line 2,463 ⟶ 2,653:
=={{header|Nemerle}}==
Compile with:<pre>ncc -reference:System.Windows.Forms goodbye.n</pre>
<
using System.Windows.Forms;
MessageBox.Show("Goodbye, World!")</
=={{header|NetRexx}}==
Using [[Java|Java's]] [http://download.oracle.com/javase/6/docs/technotes/guides/swing/index.html Swing Foundation Classes].
{{libheader|Swing}}
<
options replace format comments java crossref symbols binary
Line 2,478 ⟶ 2,668:
msgText = 'Goodbye, World!'
JOptionPane.showMessageDialog(null, msgText)
</syntaxhighlight>
An alternative version using other Swing classes.
{{libheader|Swing}}
<
options replace format comments java crossref symbols binary
Line 2,509 ⟶ 2,699:
method isFalse() public static returns boolean
return \isTrue
</syntaxhighlight>
An example using [[Java|Java's]] [http://download.oracle.com/javase/6/docs/technotes/guides/awt/index.html Abstract Window Toolkit (AWT)]
{{libheader|AWT}}
<
options replace format comments java crossref symbols binary
Line 2,602 ⟶ 2,792:
method isFalse() public static returns boolean
return \isTrue
</syntaxhighlight>
=={{header|newLISP}}==
Line 2,608 ⟶ 2,798:
NewLISP uses a lightweight Java GUI server that it communicates with over a pipe, similar how some languages use Tcl/Tk. This takes advantage of Java's cross platform GUI capability.
<
; oofoe 2012-01-18
Line 2,631 ⟶ 2,821:
(exit) ; NewLisp normally goes to listener after running script.
</syntaxhighlight>
<
> (! "dialog --msgbox GoodbyeWorld! 5 20")
; A dialog message box appears on terminal similar to yes/no box. </
=={{header|Nim}}==
==={{libheader|GTK2}}===
<
gtk2.nim_init()
info(nil, "Hello World")</
==={{libheader|IUP}}===
<
discard iup.open(nil, nil)
message("Hello", "Hello World")
close()</
=={{header|NS-HUBASIC}}==
<
20 PRINT "GOODBYE, WORLD!"</
=={{header|Nyquist}}==
===Audacity plug-in (Lisp syntax)===
<
;version 4
;type tool
;name "Goodbye World"
(print "Goodbye, World!")</
===Audacity plug-in (SAL syntax)===
<
;version 4
;type tool
Line 2,671 ⟶ 2,861:
;name "Goodbye World"
return "Goodbye, World!"</
=={{header|Objeck}}==
{{libheader|Qt}}
<
use Qt;
Line 2,691 ⟶ 2,881:
}
}
</syntaxhighlight>
=={{header|Objective-C}}==
To show a modal alert (Mac):
<
[alert setMessageText:@"Goodbye, World!"];
[alert runModal];</
To show a modal alert (iOS):
<
[alert show];</
=={{header|OCaml}}==
{{libheader|GTK}}
<
let destroy () = GMain.Main.quit ()
Line 2,718 ⟶ 2,908:
;;
let _ = main () ;;</
{{libheader|OCaml-Xlib}}
Line 2,727 ⟶ 2,917:
Just output as a label in a window:
<
let main_widget = Tk.openTk () in
let lbl = Label.create ~text:"Goodbye, World" main_widget in
Tk.pack [lbl];
Tk.mainLoop();;</
Output as text on a button that exits the current application:
<
let action () = exit 0 in
let main_widget = Tk.openTk () in
Line 2,740 ⟶ 2,930:
Button.create main_widget ~text:"Goodbye, World" ~command:action in
Tk.pack [bouton_press];
Tk.mainLoop();;</
=={{header|Ol}}==
{{libheader|Win32}}
<syntaxhighlight lang="ol">
(import (lib winapi))
(MessageBox #f (c-string "Hello, World!") (c-string "Rosettacode") #x40)
</syntaxhighlight>
=={{header|OpenEdge/Progress}}==
<
=={{header|OxygenBasic}}==
Line 2,765 ⟶ 2,955:
<br clear=both>
Requires a Glade GUI description file. 'ere be one I produced earlier:
<
<?xml version="1.0" standalone="no"?> <!--*- mode: xml -*-->
<!DOCTYPE glade-interface SYSTEM "http://glade.gnome.org/glade-2.24.dtd">
Line 2,789 ⟶ 2,979:
</glade-interface>
</syntaxhighlight>
And finally the Oxygene:
<
// Display a Message in a GUI Window
//
Line 2,839 ⟶ 3,029:
end.
</syntaxhighlight>
===.NET===
[[File:OxygeneNEThw.jpg|left|HelloWorld]]
<br clear=both>
<
namespace HelloWorldNET;
Line 2,862 ⟶ 3,052:
end.
</syntaxhighlight>
=={{header|Oz}}==
<
[QTk] = {Module.link ['x-oz://system/wp/QTk.ozf']}
Window = {QTk.build td(label(text:"Goodbye, World!"))}
in
{Window show}</
=={{header|Panoramic}}==
<
'Prints in the upper left corner of the window.
</syntaxhighlight>
=={{header|PARI/GP}}==
<
plotstring(1, "Goodbye, World!");
plotdraw([1, 0, 15]);</
=={{header|Pascal}}==
Line 2,885 ⟶ 3,075:
{{libheader|Gtk2}}
Variant of the C example:
<
uses
Line 2,906 ⟶ 3,096:
gtk_main();
end.</
=={{header|PascalABC.NET}}==
<syntaxhighlight lang="pascal">
// Hello world/Graphical. Nigel Galloway: January 16th., 2023
begin
System.Windows.Forms.MessageBox.Show('Farewell Cruel World!')
end.
</syntaxhighlight>
=={{header|Perl}}==
{{works with|Perl|5.8.8}}
Line 2,914 ⟶ 3,111:
Just output as a label in a window:
<
use strict;
use warnings;
Line 2,921 ⟶ 3,118:
my $main = MainWindow->new;
$main->Label(-text => 'Goodbye, World')->pack;
MainLoop();</
Output as text on a button that exits the current application:
<
use warnings;
use Tk;
Line 2,934 ⟶ 3,131:
-command => \&exit,
)->pack;
MainLoop();</
==={{libheader|Perl/Gtk2}}===
<
use warnings;
use Gtk2 '-init';
Line 2,951 ⟶ 3,148:
$window->show_all;
Gtk2->main;</
==={{libheader|Perl/Qt}}===
<
use warnings;
use QtGui4;
Line 2,961 ⟶ 3,158:
my $label = Qt::Label('Goodbye, World');
$label->show;
exit $app->exec;</
=={{header|Phix}}==
{{libheader|Phix/basics}}
{{libheader|Phix/pGUI}}
<!--<
<span style="color: #008080;">include</span> <span style="color: #000000;">pGUI</span><span style="color: #0000FF;">.</span><span style="color: #000000;">e</span>
<span style="color: #7060A8;">IupOpen</span><span style="color: #0000FF;">()</span>
<span style="color: #7060A8;">IupMessage</span><span style="color: #0000FF;">(</span><span style="color: #008000;">"Bye"</span><span style="color: #0000FF;">,</span><span style="color: #008000;">"Goodbye, World!"</span><span style="color: #0000FF;">)</span>
<span style="color: #7060A8;">IupClose</span><span style="color: #0000FF;">()</span>
<!--</
=== better ===
{{libheader|Phix/online}}
You can run this online [http://phix.x10.mx/p2js/hello_world.htm here]. A few improvements are probably warranted, as in changes to pGUI.js and/or pGUI.css, but at least the language/transpiler side of things is pretty much complete.
<!--<syntaxhighlight lang="phix">(phixonline)-->
<span style="color: #000080;font-style:italic;">--
-- pwa\phix\hello_world.exw
-- ========================
--</span>
<span style="color: #008080;">with</span> <span style="color: #008080;">javascript_semantics</span>
<span style="color: #008080;">include</span> <span style="color: #000000;">pGUI</span><span style="color: #0000FF;">.</span><span style="color: #000000;">e</span>
<span style="color: #7060A8;">IupOpen</span><span style="color: #0000FF;">()</span>
<span style="color: #004080;">Ihandle</span> <span style="color: #000000;">lbl</span> <span style="color: #0000FF;">=</span> <span style="color: #7060A8;">IupFlatLabel</span><span style="color: #0000FF;">(</span><span style="color: #008000;">"World!"</span><span style="color: #0000FF;">,</span><span style="color: #008000;">"EXPAND=YES, ALIGNMENT=ACENTER"</span><span style="color: #0000FF;">)</span>
<span style="color: #004080;">Ihandln</span> <span style="color: #000000;">dlg</span> <span style="color: #0000FF;">=</span> <span style="color: #7060A8;">IupDialog</span><span style="color: #0000FF;">(</span><span style="color: #000000;">lbl</span><span style="color: #0000FF;">,</span><span style="color: #008000;">"TITLE=Hello, RASTERSIZE=215x85"</span><span style="color: #0000FF;">)</span>
<span style="color: #7060A8;">IupShow</span><span style="color: #0000FF;">(</span><span style="color: #000000;">dlg</span><span style="color: #0000FF;">)</span>
<span style="color: #008080;">if</span> <span style="color: #7060A8;">platform</span><span style="color: #0000FF;">()!=</span><span style="color: #004600;">JS</span> <span style="color: #008080;">then</span>
<span style="color: #7060A8;">IupMainLoop</span><span style="color: #0000FF;">()</span>
<span style="color: #000000;">dlg</span> <span style="color: #0000FF;">=</span> <span style="color: #7060A8;">IupDestroy</span><span style="color: #0000FF;">(</span><span style="color: #000000;">dlg</span><span style="color: #0000FF;">)</span>
<span style="color: #7060A8;">IupClose</span><span style="color: #0000FF;">()</span>
<span style="color: #008080;">end</span> <span style="color: #008080;">if</span>
<!--</syntaxhighlight>-->
=={{header|PHP}}==
{{libheader|PHP-GTK}}
<
{
die("Please load the php-gtk2 module in your php.ini\r\n");
Line 2,988 ⟶ 3,206:
$wnd->show_all();
Gtk::main();</
=={{header|PicoLisp}}==
<
=={{header|Plain English}}==
<
Start up.
Clear the screen.
Line 3,000 ⟶ 3,218:
Refresh the screen.
Wait for the escape key.
Shut down.</
=={{header|Portugol}}==
<syntaxhighlight lang="portugol">
programa {
// includes graphics library and use an alias
inclua biblioteca Graficos --> g
// define WIDTH and HEIGHT integer constants
const inteiro WIDTH = 200
const inteiro HEIGHT = 100
// main entry
funcao inicio() {
// begin graphical mode (verdadeiro = true)
g.iniciar_modo_grafico(verdadeiro)
// define window title
g.definir_titulo_janela("Hello")
// define window dimesions
g.definir_dimensoes_janela(WIDTH, HEIGHT)
// while loop
enquanto (verdadeiro) {
// define color to black(preto) and clear window
g.definir_cor(g.COR_PRETO)
g.limpar()
// define color to white(branco)
g.definir_cor(g.COR_BRANCO)
// set text font size
g.definir_tamanho_texto(32.0)
// draws text
g.desenhar_texto(0, HEIGHT / 3, "Hello, world!")
// calls render function
g.renderizar()
}
// end graphical mode
g.encerrar_modo_grafico()
}
}
</syntaxhighlight>
=={{header|PostScript}}==
In the general Postscript context, the <tt>show</tt> command will render the string that is topmost on the stack at the <tt>currentpoint</tt> in the previously <tt>setfont</tt>. Thus a minimal PostScript file that will print on a PostScript printer or previewer might look like this:
<
% render in Helvetica, 12pt:
/Helvetica findfont 12 scalefont setfont
Line 3,013 ⟶ 3,276:
(Goodbye, World!) show
% wrap up page display:
showpage</
=={{header|PowerBASIC}}==
{{works with|PB/Win}}
<
MSGBOX "Goodbye, World!"
END FUNCTION</
=={{header|PowerShell}}==
{{libheader|WPK}}<br/>
{{works with|PowerShell|2}}
<
{{libheader|Windows Forms}}
<
$label = New-Object System.Windows.Forms.Label
Line 3,035 ⟶ 3,298:
$form.Controls.Add($label)
$Form.ShowDialog() | Out-Null</
Alternatively, simply as a message box:
{{libheader|Windows Forms}}
<
=={{header|Processing}}==
Uses default Processing methods and variables.
<syntaxhighlight lang="processing">
fill(0, 0, 0);
text("Goodbye, World!",0,height/2);
</syntaxhighlight>
=={{header|Prolog}}==
Works with SWI-Prolog and XPCE. <br><br>
A simple message box :
<
A more sophisticated window :
<
new(D, window('Goodbye')),
send(D, size, size(250, 100)),
Line 3,062 ⟶ 3,328:
send(D, display, T, point(XT, YT)),
send(D, open).
</syntaxhighlight>
=={{header|Pure Data}}==
Line 3,077 ⟶ 3,343:
=={{header|PureBasic}}==
<
Using the Windows API:
<
=={{header|Python}}==
{{works with|Python & Blender|3.x}}
==={{libheader|Blender}}===
<syntaxhighlight lang="python">import bpy
# select default cube
bpy.data.objects['Cube'].select_set(True)
# delete default cube
bpy.ops.object.delete(True)
# add text to Blender scene
bpy.data.curves.new(type="FONT", name="Font Curve").body = "Hello World"
font_obj = bpy.data.objects.new(name="Font Object", object_data=bpy.data.curves["Font Curve"])
bpy.context.scene.collection.objects.link(font_obj)
# camera center to text
bpy.context.scene.camera.location = (2.5,0.3,10)
# camera orient angle to text
bpy.context.scene.camera.rotation_euler = (0,0,0)
# change 3D scene to view from the camera
area = next(area for area in bpy.context.screen.areas if area.type == 'VIEW_3D')
area.spaces[0].region_3d.view_perspective = 'CAMERA'</syntaxhighlight>
{{works with|Python|2.x}}
==={{libheader|Tkinter}}===
<
result = tkMessageBox.showinfo("Some Window Label", "Goodbye, World!")</
'''Note:''' The result is a string of the button that was pressed.
Line 3,092 ⟶ 3,383:
{{works with|Python|3.x}}
{{libheader|Tkinter}}
<
result = messagebox.showinfo("Some Window Label", "Goodbye, World!")</
==={{libheader|PyQt}}===
<
app = PyQt4.QtGui.QApplication([])
pb = PyQt4.QtGui.QPushButton('Hello World')
pb.connect(pb,PyQt4.QtCore.SIGNAL("clicked()"),pb.close)
pb.show()
exit(app.exec_())</
==={{libheader|PyGTK}}===
<
pygtk.require('2.0')
import gtk
Line 3,114 ⟶ 3,405:
window.connect('delete-event', gtk.main_quit)
window.show_all()
gtk.main()</
==={{libheader|VPython}}===
{{works with|Python|2.7.5}}
<
# HelloWorld for VPython - HaJo Gurt - 2014-09-20
from visual import *
Line 3,173 ⟶ 3,464:
S.rotate( angle=rot, axis=(0,1,0) )
</syntaxhighlight>
==={{libheader|WxPython}}===
<
app = wx.App(False)
frame = wx.Frame(None, wx.ID_ANY, "Hello, World")
frame.Show(True)
app.MainLoop()</
==={{libheader|Kivy}}===
<
from kivy.app import App
from kivy.uix.floatlayout import FloatLayout
Line 3,206 ⟶ 3,497:
GoodByeApp().run()
</syntaxhighlight>
==={{libheader|Kivy}}===
With kv language
<
from kivy.app import App
Line 3,242 ⟶ 3,533:
GoodByeApp().run()
</syntaxhighlight>
=={{header|Quackery}}==
<syntaxhighlight lang="Quackery"> [ $ "turtleduck.qky" loadfile ] now!
[ $ /
import turtle
size = from_stack()
words = string_from_stack()
turtle.write(words,align="center",
font=("Arial", size, "normal"))
/ python ] is write
turtle 0 frames
255 times
[ clear
i^ 3 of colour
$ "Goodbye, World!"
i write
frame ]</syntaxhighlight>
{{out}}
[[File:Quackery Goodbye World.gif]]
=={{header|R}}==
{{libheader|GTK}}
Rather minimalist, but working...
<
w <- gtkWindowNew()
l <- gtkLabelNew("Goodbye, World!")
w$add(l)</
=={{header|Racket}}==
<
(require racket/gui/base)
Line 3,272 ⟶ 3,586:
; Show the frame by calling its show method
(send frame show #t)</
=={{header|Raku}}==
Line 3,279 ⟶ 3,593:
{{libheader|GTK}}
<syntaxhighlight lang="raku"
use GTK::Simple::App;
Line 3,285 ⟶ 3,599:
$app.border-width = 20;
$app.set-content( GTK::Simple::Label.new(text => "Goodbye, World!") );
$app.run;</
=={{header|RapidQ}}==
<
=={{header|Rascal}}==
<
import vis::Figure;
import vis::Render;
Line 3,297 ⟶ 3,611:
public void GoodbyeWorld() =
render(box(text("Goodbye World")));
</syntaxhighlight>
Output:
[[File:Goodbyeworld.png]]
=={{header|REALbasic}}==
<syntaxhighlight lang="vb">
MsgBox("Goodbye, World!")
</syntaxhighlight>
=={{header|REBOL}}==
<
=={{header|Red}}==
<
=={{header|REXX}}==
Line 3,317 ⟶ 3,631:
:::* PC/REXX
:::* Personal REXX
<
if fcnPkg('rxWindow') ¬== 1 then do
say 'RXWINDOW function package not loaded.'
Line 3,329 ⟶ 3,643:
call w_put window#, 2, 2, center("Goodbye, World!", 80-2)
/*stick a fork in it, all we're done. */</
'''output'''
<pre>
Line 3,344 ⟶ 3,658:
<br>and it creates two windows, the first (main) window contains the '''Goodbye, World!''' text,
<br>the other "help" window contains a message about how to close the windows.
<
parse upper version !ver .; !pcrexx= !ver=='REXX/PERSONAL' | !ver=='REXX/PC'
if ¬!pcrexx then call ser "This isn't PC/REXX" /*this isn't PC/REXX ? */
Line 3,372 ⟶ 3,686:
parse var curPos row col
call cursor row, col
/*stick a fork in it, we're all done. */</
=={{header|Ring}}==
<
Load "guilib.ring"
New qApp {
Line 3,384 ⟶ 3,698:
exec()
}
</syntaxhighlight>
=={{header|Robotic}}==
Since visuals are already built in, [[Hello world/Newbie#Robotic|this link]] does the same thing.
=={{header|RPL}}==
{{works with|HP|48G}}
"Goodbye world!" MSGBOX
=={{header|Ruby}}==
{{libheader|GTK}}
<
window = Gtk::Window.new
Line 3,398 ⟶ 3,716:
window.show_all
Gtk.main</
{{libheader|Ruby/Tk}}
<
root = TkRoot.new("title" => "User Output")
TkLabel.new(root, "text"=>"CHUNKY BACON!").pack("side"=>'top')
Tk.mainloop</
{{libheader|Shoes}}
<
Shoes.app do
para "CHUNKY BACON!", :size => 72
end</
{{libheader|Gosu}}
<
require 'gosu'
Line 3,430 ⟶ 3,748:
end
Window.new.show</
{{libheader|Green shoes}}
<
#_Note: this code must not be executed through a GUI
require 'green_shoes'
Line 3,440 ⟶ 3,758:
para "Hello world"
end
</syntaxhighlight>
{{libheader|Win32ole}}
<
require 'win32ole'
WIN32OLE.new('WScript.Shell').popup("Hello world")
</syntaxhighlight>
=={{header|Run BASIC}}==
<
html "<script>alert('Goodbye, World!');</script>"</
=={{header|Rust}}==
==={{libheader|GTK}}===
<
extern crate gtk;
use gtk::traits::*;
Line 3,475 ⟶ 3,793:
window.show_all();
gtk::main();
}</
=={{header|Scala}}==
Line 3,482 ⟶ 3,800:
===Ad hoc REPL solution===
Ad hoc solution as [http://en.wikipedia.org/wiki/Read%E2%80%93eval%E2%80%93print_loop REPL] script:
<
===JVM Application===
Longer example, as an application:
<
object GoodbyeWorld extends SimpleSwingApplication {
Line 3,496 ⟶ 3,814:
}
}
}</
===.Net Framework===
<
object HelloDotNetWorld {
Line 3,505 ⟶ 3,823:
("Goodbye, World!")
}
}</
=={{header|Scheme}}==
Line 3,511 ⟶ 3,829:
{{libheader|Scheme/PsTk}}
<
#!r6rs
Line 3,527 ⟶ 3,845:
(tk-event-loop tk)
</syntaxhighlight>
=={{header|Scilab}}==
<
=={{header|Scratch}}==
Line 3,536 ⟶ 3,854:
=={{header|ScratchScript}}==
<
print "Goodbye, World!"</
This example waits until the mouse is clicked for the program to end. This can be useful if the program executes too fast for "Hello world!" to be visible on the screen long enough for it to be comfortable.
<
print "Goodbye, World!"
delayOnClick</
=={{header|Seed7}}==
Line 3,552 ⟶ 3,870:
the area is currently covered or off screen.
<
include "draw.s7i";
include "keybd.s7i";
Line 3,572 ⟶ 3,890:
write(screen, "Goodbye, World");
ignore(getc(KEYBOARD));
end func;</
=={{header|SenseTalk}}==
<
=={{header|Sidef}}==
{{libheader|Tk}}
<
var main = %
main.Button(
'-text' => 'Goodbye, World!',
'-command' => 'exit',
).pack
tk.MainLoop
{{libheader|Gtk2}}
<
var window = %O<Gtk2::Window>.new
var label = %O<Gtk2::Label>.new('Goodbye, World!')
window.set_title('Goodbye, World!')
window.signal_connect(destroy => { gtk2.main_quit })
window.add(label)
window.show_all
gtk2.main</syntaxhighlight>
{{libheader|Gtk3}}
<syntaxhighlight lang="ruby">use('Gtk3 -init')
var gtk3 = %O'Gtk3'
var window = %O'Gtk3::Window'.new
var label = %O'Gtk3::Label'.new('Goodbye, World!')
window.set_title('Goodbye, World!')
window.signal_connect(destroy => { gtk3.main_quit })
window.add(label)
window.show_all
gtk3.main</syntaxhighlight>
=={{header|Slope}}==
The gui module is an optional module when you compile the slope interpreter. With the module installed the following will produce a window with the text "Goodbye, world!" and the title of the window will be "Goodbye".
<syntaxhighlight lang="slope">
(define gui (gui-create))
(gui-add-window gui "Goodbye")
(window-set-content
gui
"Goodbye"
(container
"max"
(widget-make-label "Goodbye, world!")))
(window-show-and-run gui "Goodbye")</syntaxhighlight>
=={{header|SmallBASIC}}==
<syntaxhighlight lang="qbasic">
w = window()
w.alert("Goodbye, World!")
</syntaxhighlight>
=={{header|Smalltalk}}==
{{works with|GNU Smalltalk}}
<
{{works with|Pharo}}
<syntaxhighlight lang
{{works with|Smalltalk/X}}
{{works with|VisualWorks Smalltalk}}
<
=={{header|SmileBASIC}}==
<
=={{header|SSEM}}==
Ok, I know this is cheating. But it isn't <i>completely</i> cheating: the SSEM uses Williams tube storage, so the memory is basically a CRT device; and this is an executable program, up to a point, because the first line includes a <tt>111 Stop</tt> instruction (disguised as a little flourish joining the tops of the <b>d</b> and the <b>b</b>).
<
10000000000001010000000000000000
10011101110111011101010111000000
Line 3,632 ⟶ 3,985:
00100100101010100010010100000000
00100100101110100011011100100000
00011011000000000000000000000000</
Once you've keyed it in, the first eighteen words of storage will look a bit like this:
<pre> oo ooo
Line 3,655 ⟶ 4,008:
=={{header|Standard ML}}==
Works with PolyML
<
open Motif ;
Line 3,673 ⟶ 4,026:
end;
</syntaxhighlight>
call
helloWindow ();
=={{header|Stata}}==
<
=={{header|Supernova}}==
<
=={{header|Swift}}==
{{trans|Objective-C}}
<
let alert = NSAlert()
alert.messageText = "Goodbye, World!"
alert.runModal()</
=={{header|Tcl}}==
{{libheader|Tk}}
Just output as a label in a window:
<
Output as text on a button that exits the current application:
<
''Note:'' If you name this program "button.tcl", you might get strange errors. <br>
Don't use the name of any internal tcl/tk-command as a filename for a tcl-script.
This shows our text in a message box:
<
=={{header|TI-83 BASIC}}==
<
:Text(0,0,"GOODBYE, WORLD!")</
=={{header|TI-89 BASIC}}==
<
Text "Goodbye, World!"
EndDlog</
=={{header|Tosh}}==
<
say "Goodbye, World!"
stop this script</
=={{header|True BASIC}}==
<syntaxhighlight lang="qbasic">SET WINDOW 0, 320, 0, 200
SET COLOR "YELLOW"
BOX AREA 20,50,40,60
SET COLOR "GREEN"
PLOT TEXT, AT 25, 45: "Goodbye, World!"
END</syntaxhighlight>
=={{header|TXR}}==
Line 3,723 ⟶ 4,085:
==== Microsoft Windows ====
<
(deffi messagebox "MessageBoxW" int (cptr wstr wstr uint)))
(messagebox cptr-null "Hello" "World" 0) ;; 0 is MB_OK</
=={{header|UNIX Shell}}==
===In a virtual terminal===
Using whiptail or dialog
<
whiptail --title 'Farewell' --msgbox 'Goodbye, World!' 7 20
</syntaxhighlight>
<
dialog --title 'Farewell' --msgbox 'Goodbye, World!' 7 20
</syntaxhighlight>
===In a graphical environment===
Using the simple dialog command xmessage, which uses the X11 Athena Widget library
<
xmessage 'Goodbye, World!'
</syntaxhighlight>
Using the zenity modal dialogue command (wraps GTK library) available with many distributions of [[Linux]]
<
zenity --info --text='Goodbye, World!'
</syntaxhighlight>
Using yad (a fork of zenity with many more advanced options)
<
yad --title='Farewell' --text='Goodbye, World!'
</syntaxhighlight>
Line 3,756 ⟶ 4,118:
The following code is altered from the TheIDE example page. It displays a blank GUI with a menu. Click on about from the menu and the goodbye world prompt appears.
<syntaxhighlight lang="cpp">
#include <CtrlLib/CtrlLib.h>
// submitted by Aykayayciti (Earl Lamont Montgomery)
Line 3,806 ⟶ 4,168:
GoodbyeWorld().Run();
}
</syntaxhighlight>
Line 3,813 ⟶ 4,175:
=={{header|Vala}}==
<
using Gtk;
Line 3,832 ⟶ 4,194:
Gtk.main();
}</
=={{header|VBA}}==
{{trans|Visual Basic}}
<
MsgBox "Goodbye, World!"
End Sub</
=={{header|VBScript}}==
<
MsgBox("Goodbye, World!")
</syntaxhighlight>
=={{header|Vedit macro language}}==
Displaying the message on status line. The message remains visible until the next keystroke, but macro execution continues.
<
Displaying a dialog box with the message and default OK button:
<
=={{header|Vim Script}}==
There are several ways to do this. From Normal mode, one way (which requires Vim version 8.2 with patch 1522) is:
<syntaxhighlight lang="vimscript">
:call popup_notification("Hello world", {})
</syntaxhighlight>
Another way (which requires Vim version 9.0 with patch 337) is:
<syntaxhighlight lang="vimscript">
:echow "Hello world"
</syntaxhighlight>
'''NB: Neither of these will work with Neovim.'''
=={{header|Visual Basic}}==
<
MsgBox "Goodbye, World!"
End Sub</
=={{header|Visual Basic .NET}}==
{{works with|Visual Basic|2005}}
<
Module GoodbyeWorld
Line 3,866 ⟶ 4,241:
Messagebox.Show("Goodbye, World!")
End Sub
End Module</
=={{header|Visual FoxPro}}==
<
MESSAGEBOX("Goodbye, World!")
* Version 2:
? "Goodbye, World!"</
=={{header|V (Vlang)}}==
<syntaxhighlight lang="v (vlang)">import ui
fn main() {
ui.message_box('Hello World')
}</syntaxhighlight>
=={{header|Web 68}}==
<
Define the structure of the program.
Line 3,905 ⟶ 4,287:
macro fl finish;
@ The end.</
=={{header|Wee Basic}}==
<
end</
=={{header|Wren}}==
{{libheader|DOME}}
<
class Game {
Line 3,923 ⟶ 4,305:
static draw(alpha) {}
}</
=={{header|X86 Assembly}}==
Line 3,932 ⟶ 4,314:
function parameters onto the stack and the stack has been fixed up
when the callee returns.
<
;;;
;;; nasm -fwin32 hellowin.asm
Line 3,958 ⟶ 4,340:
title:
db 'RosettaCode sample',0
</syntaxhighlight>
{{works with|FASM on Windows}}
<
;use win32ax for 32 bit
;use win64ax for 64 bit
Line 3,971 ⟶ 4,353:
invoke ExitProcess,0
.end start
</syntaxhighlight>
=={{header|X86-64 Assembly}}==
===UASM 2.52===
Not sure if ncurses counts as 'graphical', but whatver..
===={{libheader|ncurses}}====
<syntaxhighlight lang="asm">
option casemap:none
printf proto :qword, :vararg
exit proto :dword
;; curses.h stuff
initscr proto ;; WINDOW *initsrc(void);
endwin proto ;; int endwin(void);
start_color proto ;; int start_color(void);
wrefresh proto :qword ;; int wrefresh(WINDOW *w);
wgetch proto :qword ;; int wgetch(WINDOW *w)
waddnstr proto :qword, :qword, :dword ;; int waddnstr(WINDOW *w, const char *str, int n);
;; Just a wrapper to make printing easier..
println proto :qword, :qword
.code
main proc
local stdscr:qword
call initscr
mov stdscr, rax
call start_color
invoke println, stdscr, CSTR("Goodbye, World!",10)
invoke wgetch, stdscr
call endwin
invoke exit, 0
ret
main endp
println proc wnd:qword, pstr:qword
invoke waddnstr, wnd, pstr, -1
invoke wrefresh, wnd
ret
println endp
end
</syntaxhighlight>
===={{libheader|GTK}}====
<syntaxhighlight lang="asm">
option casemap:none
gtk_main proto
gtk_main_quit proto
gtk_window_get_type proto
gtk_widget_show_all proto :qword
exit proto :dword
gtk_window_new proto :dword
printf proto :dword, :vararg
g_type_check_instance_cast proto :qword, :qword
gtk_init proto :qword, :qword
gtk_window_set_title proto :qword, :qword
g_signal_connect_data proto :qword, :qword, :qword, :dword, :dword, :dword
del_event proto
.data
tlt db "hello_gtk",0
agc dq 1
agv dq ags
ags dq tlt
dq 0
.code
main proc
local hwnd:qword
local tmp:qword
invoke printf, CSTR("-> Starting GTK with argc:%i - argv ptr: 0x%x",10), agc, agv
lea rax, agc
lea rbx, agv
invoke gtk_init, rax, rbx
invoke gtk_window_new, 0
mov hwnd, rax
invoke printf, CSTR("-> Main window handle: %d",10), hwnd
call gtk_window_get_type
mov tmp, rax
invoke printf, CSTR("-> Window type: %d",10), tmp
invoke g_type_check_instance_cast, hwnd, tmp
mov tmp, rax
invoke gtk_window_set_title, tmp, CSTR("Goodbye, World.")
invoke g_type_check_instance_cast, hwnd, 0x50
mov tmp, rax
lea rax, del_event
invoke g_signal_connect_data, tmp, CSTR("delete-event"), rax, 0, 0, 0
invoke gtk_widget_show_all, hwnd
call gtk_main
;invoke exit, 0
ret
main endp
del_event proc
invoke printf, CSTR("-> Exit event called..",10)
call gtk_main_quit
ret
del_event endp
end
</syntaxhighlight>
=={{header|XPL0}}==
This sets up a 320x200x8 (VGA) graphics screen and writes text on it.
<
=={{header|XSLT}}==
Line 3,981 ⟶ 4,466:
The output is an SVG document. The idea is that it's straightforward to use XSLT to turn an existing SVG into an instantiable template.
<
<xsl:output method="xml"/>
<xsl:template match="/*">
Line 4,001 ⟶ 4,486:
</svg>
</xsl:template>
</xsl:stylesheet></
Sample input:
<
Sample output (with formatting non-destructively adjusted):
<
<rect x="0" y="0" width="400" height="200" fill="cyan"/>
<circle cx="200" cy="100" r="50" fill="yellow"/>
Line 4,016 ⟶ 4,501:
text-anchor: middle;
fill: black;">Goodbye, World!</text>
</svg></
=={{header|Yabasic}}==
<
text 10, 20, "Hello world"
color 255, 0, 0 : text 10, 40, "Good bye world", "roman14"</
=={{header|zkl}}==
zkl doesn't have a decent GUI ffi but, on my Linux box, the following work:
<
System.cmd(0'|notify-send "Goodbye, World!"|); // desktop notification
System.cmd(0'|xmessage -buttons Ok:0,"Not sure":1,Cancel:2 -default Ok -nearmouse "Goodbye, World!" -timeout 10|); // X Windows dialog</
The quote quote syntax is 0'<char>text<char> or you can use \ (eg "\"Goodbye, World!\"")
|