Rust egui Tutorial #2 — Text Widgets: Labels, Headings & More

Codegiz — Built by Claude AI · Beginner ·🛠️ AI Tools & Apps ·1mo ago

About this lesson

Display text in your egui app! In this episode, we explore the core text widgets: headings for bold titles, labels for read-only text, separators for visual dividers, and monospace for code-style output. We also use the format!() macro to build dynamic text with variables. Student code: https://github.com/GoCelesteAI/egui_labels_and_headings What You'll Learn: - ui.heading() for large bold section titles - ui.label() for normal read-only text - ui.separator() for horizontal dividing lines - ui.monospace() for fixed-width code-style text - format!() macro for dynamic text with variables Neovim Skills: - j/k — Navigate files in Neo-tree - Enter — Open file from Neo-tree Prerequisites: - Rust installed (rustup.rs) - Basic Rust knowledge (variables, functions, structs) - Neovim installed - Completed Episode 1 (Your First Window) Timestamps: 0:00 Intro 0:12 Preview 0:44 Writing the code 9:50 App Demo 10:10 Recap 10:50 Outro Taught by CelesteAI #rust #egui #gui #neovim #tutorial #beginner #eframe --- Tags rust, egui, gui, desktop app, neovim, neo-tree, tutorial, beginner, eframe, rust gui, label, heading, separator, monospace, rust tutorial, egui tutorial

Full Transcript

Learn egui in Neovim, episode two, labels and headings. Display text with headings, labels, separators, and monospace. Egui provides several widgets for displaying text. Heading shows large bold text. Label shows normal text. Separator draws a horizontal line between sections. Monospace displays text in a fixed-width code font. Cargo new creates a fresh Rust project. We enter the new project directory. Open Neovim. No file argument needed. Space e opens Neo-tree on the right. J moves down to navigate. Enter opens the file. Cargo.toml manages dependencies. G jumps to the bottom. Add eframe 0.31 for the egui framework. Save with colon w. Colon e switches files. Open src/main.rs. Clear the file and start fresh. Import egui from eframe. >> The main function returns eframe result. Native options configures the window. Viewport builder sets window size 400 by 350 pixels. Dot dot default fills remaining options. Run underscore native launches the window with a title and our app. The title says labels and headings. Box new wraps our app. The closure creates it on startup. >> Close the main function. My app holds our application state. One field, name. Default sets the initial name to world. >> Impl app is where we draw the interface. Central panel fills the window. Heading displays large bold text. Our page title. Separator draws a horizontal line between sections. Label shows normal read-only text. We add two labels explaining what they do. >> Another separator. Then a second heading. Labels can show dynamic text with format macro. A third separator before the monospace section. Monospace displays text in a fixed-width code font. Save with colon W 51 lines of rust. G G scrolls to top. Review the full file. Colon bang cargo build. Compile inside neovim. Cargo compiles all dependencies. Cargo.lock appeared after the build. Our labels and headings app is ready to run. Our app running. Headings, labels, separators, and monospace. Each widget serves a different purpose for text display. Separator creates clean visual sections. Recap, five key takeaways. First, heading displays large bold text. Second, label shows normal read-only text. Third, separator draws a horizontal dividing line. Fourth, monospace shows fixed width code text. Fifth, format macro builds dynamic text with variables. Thanks for watching. Like and subscribe for more egui tutorials. Next episode, buttons and state. >> Mhm.

Original Description

Display text in your egui app! In this episode, we explore the core text widgets: headings for bold titles, labels for read-only text, separators for visual dividers, and monospace for code-style output. We also use the format!() macro to build dynamic text with variables. Student code: https://github.com/GoCelesteAI/egui_labels_and_headings What You'll Learn: - ui.heading() for large bold section titles - ui.label() for normal read-only text - ui.separator() for horizontal dividing lines - ui.monospace() for fixed-width code-style text - format!() macro for dynamic text with variables Neovim Skills: - j/k — Navigate files in Neo-tree - Enter — Open file from Neo-tree Prerequisites: - Rust installed (rustup.rs) - Basic Rust knowledge (variables, functions, structs) - Neovim installed - Completed Episode 1 (Your First Window) Timestamps: 0:00 Intro 0:12 Preview 0:44 Writing the code 9:50 App Demo 10:10 Recap 10:50 Outro Taught by CelesteAI #rust #egui #gui #neovim #tutorial #beginner #eframe --- Tags rust, egui, gui, desktop app, neovim, neo-tree, tutorial, beginner, eframe, rust gui, label, heading, separator, monospace, rust tutorial, egui tutorial
Watch on YouTube ↗ (saves to browser)
Sign in to unlock AI tutor explanation · ⚡30

Related Reads

📰
Build an AI Error Explainer in Python
Learn to build an AI-powered error explainer in Python to turn stack traces into actionable debugging JSON
Dev.to AI
📰
I Built 4 Interactive Engineering Tools You Can Run in Your Browser
Learn how to build interactive engineering tools that run in your browser, making complex concepts more engaging and accessible
Dev.to · Dhananjay kumar Seth
📰
Teaching Smarter with AI: How Teachers Can Save Time, Create Better Lessons, and Personalize…
Learn how AI can help teachers save time, create better lessons, and personalize learning for their students
Medium · AI
📰
Stop Buying on Instinct: Build an AI Comparison System for Life and Business
Learn to build an AI comparison system to make informed purchasing decisions and avoid costly mistakes
Medium · AI

Chapters (6)

Intro
0:12 Preview
0:44 Writing the code
9:50 App Demo
10:10 Recap
10:50 Outro
Up next
Anyword's Performance Boost AI Integration
Anyword
Watch →