The current, stable, release of Terminal.Gui is v1.x. It is stable, rich, and broadly used. The team is now focused on designing and building a significant upgrade we're referring to as v2
. Therefore:
v1
is now in maintenance mode, meaning we will accept PRs for v1.x (the develop
branch) only for issues impacting existing functionality.v2_develop
branch. See the V2 discussion here.v2_develop
) can be found here.v2
is stable.Terminal.Gui: A toolkit for building rich console apps for .NET, .NET Core, and Mono that works on Windows, the Mac, and Linux/Unix.
Paste these commands into your favorite terminal on Windows, Mac, or Linux. This will install the Terminal.Gui.Templates, create a new "Hello World" TUI app, and run it.
(Press CTRL-Q
to exit the app)
dotnet new --install Terminal.Gui.templates
dotnet new tui -n myproj
cd myproj
dotnet run
The Documentation matches the most recent Nuget release from the main
branch ()
See the Terminal.Gui/
README for an overview of how the library is structured. The Conceptual Documentation provides insight into core concepts.
Clipboard
class.View
class, and these in turn can contain an arbitrary number of sub-views.Terminal.Gui can be used with any .Net language to create feature rich and robust applications.
Showcase is a place where you can find all kind of projects from simple examples to advanced real world apps that fully utilize capabilities of the toolkit.
The team is looking forward to seeing new amazing projects made by the community to be added there!
The following example shows a basic Terminal.Gui application in C#:
// A simple Terminal.Gui example in C# - using C# 9.0 Top-level statements
using Terminal.Gui;
Application.Run<ExampleWindow> ();
System.Console.WriteLine ($"Username: {((ExampleWindow)Application.Top).usernameText.Text}");
// Before the application exits, reset Terminal.Gui for clean shutdown
Application.Shutdown ();
// Defines a top-level window with border and title
public class ExampleWindow : Window {
public TextField usernameText;
public ExampleWindow ()
{
Title = "Example App (Ctrl+Q to quit)";
// Create input components and labels
var usernameLabel = new Label () {
Text = "Username:"
};
usernameText = new TextField ("") {
// Position text field adjacent to the label
X = Pos.Right (usernameLabel) + 1,
// Fill remaining horizontal space
Width = Dim.Fill (),
};
var passwordLabel = new Label () {
Text = "Password:",
X = Pos.Left (usernameLabel),
Y = Pos.Bottom (usernameLabel) + 1
};
var passwordText = new TextField ("") {
Secret = true,
// align with the text box above
X = Pos.Left (usernameText),
Y = Pos.Top (passwordLabel),
Width = Dim.Fill (),
};
// Create login button
var btnLogin = new Button () {
Text = "Login",
Y = Pos.Bottom(passwordLabel) + 1,
// center the login button horizontally
X = Pos.Center (),
IsDefault = true,
};
// When login button is clicked display a message popup
btnLogin.Clicked += () => {
if (usernameText.Text == "admin" && passwordText.Text == "password") {
MessageBox.Query ("Logging In", "Login Successful", "Ok");
Application.RequestStop ();
} else {
MessageBox.ErrorQuery ("Logging In", "Incorrect username or password", "Ok");
}
};
// Add the views to the Window
Add (usernameLabel, usernameText, passwordLabel, passwordText, btnLogin);
}
}
When run the application looks as follows:
Sample application running
Use NuGet to install the Terminal.Gui
NuGet package: https://www.nuget.org/packages/Terminal.Gui
To install Terminal.Gui into a .NET Core project, use the dotnet
CLI tool with this command.
dotnet add package Terminal.Gui
Or, you can use the Terminal.Gui.Templates.
dotnet build
in the root directory). Run UICatalog
with dotnet run --project UICatalog
.Terminal.sln
with Visual Studio 2022.See CONTRIBUTING.md for instructions for downloading and forking the source.
See CONTRIBUTING.md.
Debates on architecture and design can be found in Issues tagged with design.
See gui-cs for how this project came to be.
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。