Add nice padding to the clock example

This commit is contained in:
Sasha Koshka 2023-01-12 18:03:08 -05:00
parent 1f3e925433
commit 60c2ccbec2

View File

@ -4,6 +4,7 @@ import "os"
import "time" import "time"
import "git.tebibyte.media/sashakoshka/tomo" import "git.tebibyte.media/sashakoshka/tomo"
import "git.tebibyte.media/sashakoshka/tomo/elements/basic" import "git.tebibyte.media/sashakoshka/tomo/elements/basic"
import "git.tebibyte.media/sashakoshka/tomo/elements/layouts"
import _ "git.tebibyte.media/sashakoshka/tomo/backends/x" import _ "git.tebibyte.media/sashakoshka/tomo/backends/x"
func main () { func main () {
@ -14,8 +15,10 @@ func main () {
func run () { func run () {
window, _ := tomo.NewWindow(2, 2) window, _ := tomo.NewWindow(2, 2)
window.SetTitle("clock") window.SetTitle("clock")
container := basic.NewContainer(layouts.Vertical { true, true })
window.Adopt(container)
label := basic.NewLabel(formatTime(), false) label := basic.NewLabel(formatTime(), false)
window.Adopt(label) container.Adopt(label, false)
window.OnClose(tomo.Stop) window.OnClose(tomo.Stop)
window.Show() window.Show()
go tick(label) go tick(label)