本文整理汇总了Golang中github.com/mattn/go-gtk/gtk.NewVBox函数的典型用法代码示例。如果您正苦于以下问题:Golang NewVBox函数的具体用法?Golang NewVBox怎么用?Golang NewVBox使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了NewVBox函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。
示例1: initPage
func initPage(title string, uri string, size_x int, size_y int) {
gtk.Init(nil)
window := gtk.NewWindow(gtk.WINDOW_TOPLEVEL)
window.SetTitle(title)
window.Connect("destroy", gtk.MainQuit)
vbox := gtk.NewVBox(false, 1)
swin := gtk.NewScrolledWindow(nil, nil)
swin.SetPolicy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
swin.SetShadowType(gtk.SHADOW_IN)
webview := webkit.NewWebView()
webview.LoadUri(uri)
swin.Add(webview)
vbox.Add(swin)
window.Add(vbox)
window.SetSizeRequest(size_x, size_y)
window.ShowAll()
proxy := os.Getenv("HTTP_PROXY")
if len(proxy) > 0 {
soup_uri := webkit.SoupUri(proxy)
webkit.GetDefaultSession().Set("proxy-uri", soup_uri)
soup_uri.Free()
}
gtk.Main()
}
开发者ID:nnoco,项目名称:GoLiathChat,代码行数:30,代码来源:Goliath.go
示例2: init_Calc
// Frame - Calculation
// This frame contains radix(16,10,8) and result labels
// ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ----
func (this *UI) init_Calc() {
// In this function, the designated frame is Calc_Frame
_Frame := this.Calc_Frame
if _Frame == nil {
panic("UI::init_Calc() : nil Frame received")
}
// (inner) Box of Calculation
fm_calc_box := gtk.NewHBox(false, 1)
if fm_calc_box == nil {
panic("UI::init_Calc() : HBox allocation Failed")
}
_Frame.Add(fm_calc_box)
// Box for Radix Buttons.
box_rdx := gtk.NewVBox(false, 1)
if box_rdx == nil {
panic("UI::init_Calc() : VBox allocation Failed")
}
btn_hex := button("Hex") // [Hex] : Hexadecimal
btn_dec := button("Dec") // [Dec] : Decimal
btn_oct := button("Oct") // [Oct] : Octal
box_rdx.Add(btn_hex)
box_rdx.Add(btn_dec)
box_rdx.Add(btn_oct)
// Insert radix buttons into the map
this.Btn_map["Hex"] = btn_hex
this.Btn_map["Dec"] = btn_dec
this.Btn_map["Oct"] = btn_oct
// Box for Result Labels
box_labels := gtk.NewVBox(false, 1)
if box_labels == nil {
panic("UI::init_Calc() : VBox allocation Failed")
}
// Place previous result
box_labels.Add(this.Lbl_prev)
// Place left and right operand
box_LnR := gtk.NewHBox(false, 3)
if box_LnR == nil {
panic("UI::init_Calc() : HBox allocation Failed")
}
box_LnR.Add(this.Lbl_lhs)
box_LnR.Add(this.Lbl_rhs)
box_labels.Add(box_LnR)
// Add both Boxes (Radix & Result) to frame box
fm_calc_box.Add(box_rdx)
fm_calc_box.Add(box_labels)
fmt.Println("UI::init_Calc() done.")
}
开发者ID:gophergala2016,项目名称:0x_Calc,代码行数:60,代码来源:layout.go
示例3: mkSidebar
func (g *GUI) mkSidebar() *gtk.ScrolledWindow {
sbVBox := gtk.NewVBox(false, 0)
sbVBox.PackStart(labelCustomFont("Tools", "Sans Bold 14"), false, false, 3)
g.showbiomes = gtk.NewCheckButtonWithLabel("Show Biomes")
g.showbiomes.SetActive(true)
g.showbiomes.Connect("toggled", g.showbiomesToggled)
sbVBox.PackStart(g.showbiomes, false, false, 3)
g.fixSnowIce = gtk.NewCheckButtonWithLabel("Fix Snow/Ice")
g.fixSnowIce.SetTooltipText("Add Snow/Ice for Taiga/Ice Plains. Remove Snow/Ice for other biomes.")
g.fixSnowIce.Connect("toggled", g.fixSnowIceToggled)
sbVBox.PackStart(g.fixSnowIce, false, false, 3)
fill := gtk.NewRadioButtonWithLabel(nil, "Fill")
fill.SetActive(true)
fill.Connect("toggled", g.mkUpdateToolFx(fill, NewFillTool()))
draw := gtk.NewRadioButtonWithLabel(fill.GetGroup(), "Draw")
drawRadius := gtk.NewSpinButtonWithRange(1, 20, 1)
drawHBox := gtk.NewHBox(false, 0)
drawHBox.PackStart(draw, true, true, 0)
drawHBox.PackStart(gtk.NewLabel("Radius:"), false, false, 3)
drawHBox.PackEnd(drawRadius, false, false, 3)
draw.Connect("toggled", g.mkUpdateToolFx(draw, NewDrawTool(func() int { return drawRadius.GetValueAsInt() })))
sbVBox.PackStart(fill, false, false, 3)
sbVBox.PackStart(drawHBox, false, false, 3)
sbVBox.PackStart(gtk.NewHSeparator(), false, false, 3)
bioHeaderHBox := gtk.NewHBox(false, 0)
bioHeaderHBox.PackStart(labelCustomFont("Biomes", "Sans Bold 14"), true, false, 0)
editBiomesBtn := gtk.NewButton()
editBiomesBtn.Add(gtk.NewImageFromStock(gtk.STOCK_EDIT, gtk.ICON_SIZE_SMALL_TOOLBAR))
editBiomesBtn.Connect("clicked", g.biomeEditor)
editBiomesBtn.SetTooltipText("Configure Biomes")
bioHeaderHBox.PackStart(editBiomesBtn, false, false, 0)
sbVBox.PackStart(bioHeaderHBox, false, false, 3)
g.bioVBoxWrap = gtk.NewVBox(false, 0)
g.bioVBox = gtk.NewVBox(false, 0)
g.bioVBoxWrap.PackStart(g.bioVBox, false, false, 0)
sbVBox.PackStart(g.bioVBoxWrap, false, false, 3)
g.updateBiomeInfo()
scrolled := gtk.NewScrolledWindow(nil, nil)
scrolled.SetPolicy(gtk.POLICY_NEVER, gtk.POLICY_AUTOMATIC)
scrolled.AddWithViewPort(sbVBox)
return scrolled
}
开发者ID:kch42,项目名称:biomed,代码行数:51,代码来源:main.go
示例4: Init
func (g *GUI) Init() {
g.biomes = ReadDefaultBiomes()
g.window = gtk.NewWindow(gtk.WINDOW_TOPLEVEL)
g.window.SetTitle("biomed")
g.accel = gtk.NewAccelGroup()
g.window.AddAccelGroup(g.accel)
menubar := g.mkMenuBar()
vbox := gtk.NewVBox(false, 0)
vbox.PackStart(menubar, false, false, 0)
hbox := gtk.NewHBox(false, 0)
g.mapw = NewMapWidget(GUICallbacks{g.reportError, g.updateInfo, g.setBusy}, MkBiomeLookup(g.biomes))
hbox.PackStart(g.mapw.DArea(), true, true, 3)
sidebar := g.mkSidebar()
hbox.PackEnd(sidebar, false, false, 3)
vbox.PackStart(hbox, true, true, 0)
g.statusbar = gtk.NewStatusbar()
g.statusContext = g.statusbar.GetContextId("mapinfo")
vbox.PackEnd(g.statusbar, false, false, 0)
g.window.Add(vbox)
g.window.SetDefaultSize(800, 600)
g.window.Connect("destroy", g.exitApp)
g.setTool(NewFillTool())
}
开发者ID:kch42,项目名称:biomed,代码行数:34,代码来源:main.go
示例5: main
func main() {
gtk.Init(nil)
window := gtk.NewWindow(gtk.WINDOW_TOPLEVEL)
window.SetTitle("Clock")
vbox := gtk.NewVBox(false, 1)
label := gtk.NewLabel("")
vbox.Add(label)
window.Add(vbox)
window.SetDefaultSize(300, 20)
window.ShowAll()
timer, _ := uv.TimerInit(nil)
timer.Start(func(h *uv.Handle, status int) {
label.SetLabel(fmt.Sprintf("%v", time.Now()))
}, 1000, 1000)
idle, _ := uv.IdleInit(nil)
idle.Start(func(h *uv.Handle, status int) {
gtk.MainIterationDo(false)
})
window.Connect("destroy", func() {
timer.Close(nil)
idle.Close(nil)
})
uv.DefaultLoop().Run()
}
开发者ID:zchee,项目名称:gouv,代码行数:28,代码来源:gui.go
示例6: NewBrowser
// NewBrowser returns a new browser component
func NewBrowser(uri string) *Browser {
vbox := gtk.NewVBox(false, 1)
urlBarEntry := gtk.NewEntry()
urlBarEntry.SetText(uri)
urlBarEntry.GrabFocus()
vbox.PackStart(urlBarEntry, false, false, 0)
swin := gtk.NewScrolledWindow(nil, nil)
swin.SetPolicy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
swin.SetShadowType(gtk.SHADOW_IN)
webview := webkit.NewWebView()
swin.Add(webview)
vbox.Add(swin)
// urlBarEntry.Connect("activate", func() {
// webview.LoadUri(urlBarEntry.GetText())
// })
//return vbox
browser := &Browser{
VBox: vbox,
WebView: webview,
URLEntry: urlBarEntry,
Link: "",
}
browser.connectSignals()
urlBarEntry.Emit("activate")
return browser
}
开发者ID:nlamirault,项目名称:actarus,代码行数:31,代码来源:tab.go
示例7: main
func main() {
gtk.Init(nil)
window := gtk.NewWindow(gtk.WINDOW_TOPLEVEL)
window.SetPosition(gtk.WIN_POS_CENTER)
window.SetTitle("Hello GTK+Go world!")
window.SetIconName("gtk-dialog-info")
window.Connect("destroy", func(ctx *glib.CallbackContext) {
gtk.MainQuit()
}, "foo")
vbox := gtk.NewVBox(false, 1)
button := gtk.NewButtonWithLabel("Hello world!")
button.SetTooltipMarkup("Say Hello World to everybody!")
button.Clicked(func() {
messagedialog := gtk.NewMessageDialog(
button.GetTopLevelAsWindow(),
gtk.DIALOG_MODAL,
gtk.MESSAGE_INFO,
gtk.BUTTONS_OK,
"Hello!")
messagedialog.Response(func() {
messagedialog.Destroy()
})
messagedialog.Run()
})
vbox.PackStart(button, false, false, 0)
window.Add(vbox)
window.SetSizeRequest(300, 50)
window.ShowAll()
gtk.Main()
}
开发者ID:olecya,项目名称:goeg,代码行数:30,代码来源:golang_hello.go
示例8: put_frames
// Locate frames on the window
// ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ----
func (this *UI) put_frames() {
box_win := gtk.NewVBox(Homogeneous, Default_Spacing)
if box_win == nil {
panic("UI::put_frames() : VBox allocation Failed")
}
vpan1 := gtk.NewVPaned()
if vpan1 == nil {
panic("UI::put_frames() : VPaned allocation failed")
}
vpan1.Pack1(this.Calc_Frame, No_Resize, No_Shrink) // Calc : Top half
hpan1 := gtk.NewHPaned()
if hpan1 == nil {
panic("UI::put_frames() : HPaned allocation failed")
}
hpan1.Pack1(this.Nums_Frame, No_Resize, No_Shrink) // Nums : Bottom-Left
hpan1.Pack2(this.Oper_Frame, No_Resize, No_Shrink) // Oper : Bottom-Right
vpan1.Pack2(hpan1, No_Resize, No_Shrink)
box_win.Add(vpan1)
if this.Win == nil {
panic("UI::put_frames() : nil Window received")
}
// Place all Layout
this.Win.Add(box_win)
fmt.Println("UI::put_frames() done.")
}
开发者ID:gophergala2016,项目名称:0x_Calc,代码行数:32,代码来源:layout.go
示例9: board_display
func board_display() {
gtk.Init(&os.Args)
window := gtk.NewWindow(gtk.WINDOW_TOPLEVEL)
window.SetPosition(gtk.WIN_POS_CENTER)
window.SetTitle("Gomoku")
window.SetResizable(false)
window.Connect("destroy", gtk.MainQuit)
player = 1
game = Gomoku{make([]int, 361), true, false, false, 1, [2]int{10, 10}, 0}
vbox := gtk.NewVBox(false, 1)
menu_bar(vbox)
configure_board(vbox)
status_bar(vbox)
hintx, hinty, lastx, lasty = -1, -1, -1, -1
go calc_hint()
window.Add(vbox)
window.SetSizeRequest(WIDTH+40, HEIGHT+50)
window.ShowAll()
gtk.Main()
}
开发者ID:Khady,项目名称:gomoku,代码行数:26,代码来源:display.go
示例10: main
func main() {
mc := memcache.New("127.0.0.1:11211")
gtk.Init(nil)
window := gtk.NewWindow(gtk.WINDOW_TOPLEVEL)
window.SetTitle("memcachedclient")
window.Connect("destroy", gtk.MainQuit)
vbox := gtk.NewVBox(false, 1)
swin := gtk.NewScrolledWindow(nil, nil)
textview := gtk.NewTextView()
textview.SetEditable(false)
textview.SetCursorVisible(false)
textview.ModifyFontEasy("monospace 12")
swin.Add(textview)
vbox.Add(swin)
buffer := textview.GetBuffer()
input := gtk.NewEntry()
input.SetEditable(true)
vbox.PackEnd(input, false, false, 0)
tag := buffer.CreateTag("red", map[string]string{"foreground": "#FF0000"})
input.Connect("activate", func() {
var iter gtk.TextIter
tokens := strings.SplitN(input.GetText(), " ", 3)
if len(tokens) == 2 && strings.ToUpper(tokens[0]) == "GET" {
if t, err := mc.Get(tokens[1]); err == nil {
buffer.GetEndIter(&iter)
buffer.Insert(&iter, string(t.Value)+"\n")
} else {
buffer.InsertWithTag(&iter, err.Error()+"\n", tag)
}
input.SetText("")
} else if len(tokens) == 3 && strings.ToUpper(tokens[0]) == "SET" {
if err := mc.Set(
&memcache.Item{
Key: tokens[1],
Value: []byte(tokens[2]),
}); err == nil {
buffer.GetEndIter(&iter)
buffer.InsertWithTag(&iter, "OK\n", tag)
} else {
buffer.InsertWithTag(&iter, err.Error()+"\n", tag)
}
input.SetText("")
}
})
input.GrabFocus()
window.Add(vbox)
window.SetSizeRequest(300, 500)
window.ShowAll()
gtk.Main()
}
开发者ID:mattn,项目名称:memcachedclient,代码行数:58,代码来源:memcachedclient.go
示例11: main
func main() {
gtk.Init(nil)
window := gtk.NewWindow(gtk.WINDOW_TOPLEVEL)
window.SetTitle("webkit")
window.Connect("destroy", gtk.MainQuit)
vbox := gtk.NewVBox(false, 1)
entry := gtk.NewEntry()
entry.SetText("http://golang.org/")
vbox.PackStart(entry, false, false, 0)
swin := gtk.NewScrolledWindow(nil, nil)
swin.SetPolicy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
swin.SetShadowType(gtk.SHADOW_IN)
webview := webkit.NewWebView()
webview.Connect("load-committed", func() {
entry.SetText(webview.GetUri())
})
swin.Add(webview)
vbox.Add(swin)
entry.Connect("activate", func() {
webview.LoadUri(entry.GetText())
})
button := gtk.NewButtonWithLabel("load String")
button.Clicked(func() {
webview.LoadString("hello Go GTK!", "text/plain", "utf-8", ".")
})
vbox.PackStart(button, false, false, 0)
button = gtk.NewButtonWithLabel("load HTML String")
button.Clicked(func() {
webview.LoadHtmlString(HTML_STRING, ".")
})
vbox.PackStart(button, false, false, 0)
button = gtk.NewButtonWithLabel("Google Maps")
button.Clicked(func() {
webview.LoadHtmlString(MAP_EMBED, ".")
})
vbox.PackStart(button, false, false, 0)
window.Add(vbox)
window.SetSizeRequest(600, 600)
window.ShowAll()
proxy := os.Getenv("HTTP_PROXY")
if len(proxy) > 0 {
soup_uri := webkit.SoupUri(proxy)
webkit.GetDefaultSession().Set("proxy-uri", soup_uri)
soup_uri.Free()
}
entry.Emit("activate")
gtk.Main()
}
开发者ID:bright-sparks,项目名称:go-webkit,代码行数:58,代码来源:webview.go
示例12: accountWindow
func accountWindow() {
// window settings
window_account := gtk.NewWindow(gtk.WINDOW_TOPLEVEL)
window_account.SetPosition(gtk.WIN_POS_CENTER)
window_account.SetTitle("Add Account")
// main container
container_main := gtk.NewVBox(false, 10)
container_user := gtk.NewHBox(false, 0)
container_pass := gtk.NewHBox(false, 0)
container_buttons := gtk.NewHBox(false, 5)
container_main.SetBorderWidth(10)
// username
user_label := gtk.NewLabel("Username")
user_entry := gtk.NewEntry()
// password
pass_label := gtk.NewLabel("Password")
pass_entry := gtk.NewEntry()
pass_entry.SetVisibility(false)
// login and cancel buttons
button_login := gtk.NewButtonWithLabel("Add")
button_cancel := gtk.NewButtonWithLabel("Cancel")
// login
button_login.Clicked(func() {
username := user_entry.GetText()
password := pass_entry.GetText()
profile, err := CreateProfile(username, password)
if err == nil && profile != nil {
println("[*] Login successful")
window_account.Destroy()
}
})
// cancel
button_cancel.Clicked(func() {
window_account.Destroy()
})
// add elements to containers
container_buttons.Add(button_login)
container_buttons.Add(button_cancel)
container_user.PackStart(user_label, false, false, 20)
container_user.PackEnd(user_entry, true, true, 1)
container_pass.PackStart(pass_label, false, false, 20)
container_pass.PackEnd(pass_entry, true, true, 1)
container_main.PackStart(container_user, false, false, 1)
container_main.PackStart(container_pass, false, false, 1)
container_main.PackStart(container_buttons, false, false, 1)
window_account.Add(container_main)
window_account.SetSizeRequest(350, 150)
window_account.SetResizable(false)
window_account.ShowAll()
}
开发者ID:kisom,项目名称:socialgopher,代码行数:58,代码来源:app.go
示例13: CreateWindow
func CreateWindow() *gtk.Window {
window := gtk.NewWindow(gtk.WINDOW_TOPLEVEL)
window.SetDefaultSize(700, 300)
vbox := gtk.NewVBox(false, 1)
CreateMenuAndToolbar(window, vbox)
CreateActivatableDemo(vbox)
window.Add(vbox)
return window
}
开发者ID:hauke96,项目名称:go-gtk,代码行数:9,代码来源:action.go
示例14: main
func main() {
FreeConsole()
gtk.Init(nil)
screenHeight := gdk.ScreenHeight()
screenWidth := gdk.ScreenWidth()
window := gtk.NewWindow(gtk.WINDOW_TOPLEVEL)
window.SetTitle("mgc")
window.SetIconName("gtk-about")
window.Connect("destroy", func() {
gtk.MainQuit()
})
vbox := gtk.NewVBox(false, 0)
menubar := gtk.NewMenuBar()
vbox.PackStart(menubar, false, false, 0)
menu := gtk.NewMenuItemWithMnemonic("_File")
menubar.Append(menu)
submenu := gtk.NewMenu()
menu.SetSubmenu(submenu)
menuitem := gtk.NewMenuItemWithMnemonic("E_xit")
menuitem.Connect("activate", func() {
gtk.MainQuit()
})
submenu.Append(menuitem)
hpaned := gtk.NewHPaned()
leftFrame := gtk.NewFrame("")
rightFrame := gtk.NewFrame("")
leftLabel := gtk.NewLabel("Left")
rightLabel := gtk.NewLabel("Right")
leftFrame.Add(leftLabel)
rightFrame.Add(rightLabel)
hpaned.Pack1(leftFrame, true, false)
hpaned.Pack2(rightFrame, true, false)
vbox.Add(hpaned)
window.Add(vbox)
window.SetSizeRequest(screenWidth/4*3, screenHeight/4*3)
window.ShowAll()
gtk.Main()
}
开发者ID:vsannikov,项目名称:mgc,代码行数:54,代码来源:main.go
示例15: main
func main() {
gtk.Init(&os.Args)
window := gtk.NewWindow(gtk.WINDOW_TOPLEVEL)
window.SetTitle("GTK DrawingArea")
window.Connect("destroy", gtk.MainQuit)
vbox := gtk.NewVBox(true, 0)
vbox.SetBorderWidth(5)
targets := []gtk.TargetEntry{
{"text/uri-list", 0, 0},
{"STRING", 0, 1},
{"text/plain", 0, 2},
}
dest := gtk.NewLabel("drop me file")
dest.DragDestSet(
gtk.DEST_DEFAULT_MOTION|
gtk.DEST_DEFAULT_HIGHLIGHT|
gtk.DEST_DEFAULT_DROP,
targets,
gdk.ACTION_COPY)
dest.DragDestAddUriTargets()
dest.Connect("drag-data-received", func(ctx *glib.CallbackContext) {
sdata := gtk.SelectionDataFromNative(unsafe.Pointer(ctx.Args(3)))
if sdata != nil {
a := (*[2000]uint8)(sdata.GetData())
files := strings.Split(string(a[0:sdata.GetLength()-1]), "\n")
for i := range files {
filename, _, _ := glib.FilenameFromUri(files[i])
files[i] = filename
}
dialog := gtk.NewMessageDialog(
window,
gtk.DIALOG_MODAL,
gtk.MESSAGE_INFO,
gtk.BUTTONS_OK,
strings.Join(files, "\n"))
dialog.SetTitle("D&D")
dialog.Response(func() {
dialog.Destroy()
})
dialog.Run()
}
})
vbox.Add(dest)
window.Add(vbox)
window.SetSizeRequest(300, 100)
window.ShowAll()
gtk.Main()
}
开发者ID:JessonChan,项目名称:go-gtk,代码行数:52,代码来源:dnd.go
示例16: buildGUI
func (g *Gui) buildGUI() {
g.MainWindow = gtk.NewWindow(gtk.WINDOW_TOPLEVEL)
g.MainWindow.SetPosition(gtk.WIN_POS_CENTER)
g.MainWindow.SetTitle("Gunnify")
g.MainWindow.SetIconName("gtk-dialog-info")
g.MainWindow.Connect("destroy", func(ctx *glib.CallbackContext) {
println("got destroy!", ctx.Data().(string))
gtk.MainQuit()
}, "foo")
g.MainWindow.SetSizeRequest(600, 300)
vbox := gtk.NewVBox(false, 0)
g.buildList(vbox)
g.MainWindow.Add(vbox)
}
开发者ID:spaghetty,项目名称:gunnify,代码行数:14,代码来源:gunnify.go
示例17: newBiomeList
func newBiomeList() *biomeList {
bl := &biomeList{
HBox: gtk.NewHBox(false, 0),
treeview: gtk.NewTreeView(),
lStore: gtk.NewListStore(glib.G_TYPE_STRING, glib.G_TYPE_STRING, glib.G_TYPE_STRING, glib.G_TYPE_STRING),
addBtn: gtk.NewButton(),
delBtn: gtk.NewButton(),
upBtn: gtk.NewButton(),
downBtn: gtk.NewButton(),
}
scroll := gtk.NewScrolledWindow(nil, nil)
scroll.SetPolicy(gtk.POLICY_NEVER, gtk.POLICY_AUTOMATIC)
scroll.Add(bl.treeview)
bl.PackStart(scroll, true, true, 3)
bl.treeview.SetModel(bl.lStore)
bl.treeview.AppendColumn(gtk.NewTreeViewColumnWithAttributes("Color", gtk.NewCellRendererText(), "background", 0))
bl.treeview.AppendColumn(gtk.NewTreeViewColumnWithAttributes("ID", gtk.NewCellRendererText(), "text", 1))
bl.treeview.AppendColumn(gtk.NewTreeViewColumnWithAttributes("Snowline", gtk.NewCellRendererText(), "text", 2))
bl.treeview.AppendColumn(gtk.NewTreeViewColumnWithAttributes("Name", gtk.NewCellRendererText(), "text", 3))
bl.treeview.GetSelection().SetMode(gtk.SELECTION_SINGLE)
bl.treeview.Connect("cursor-changed", bl.onCursorChanged)
vbox := gtk.NewVBox(false, 0)
bl.addBtn.Add(gtk.NewImageFromStock(gtk.STOCK_ADD, gtk.ICON_SIZE_SMALL_TOOLBAR))
bl.delBtn.Add(gtk.NewImageFromStock(gtk.STOCK_DELETE, gtk.ICON_SIZE_SMALL_TOOLBAR))
bl.upBtn.Add(gtk.NewImageFromStock(gtk.STOCK_GO_UP, gtk.ICON_SIZE_SMALL_TOOLBAR))
bl.downBtn.Add(gtk.NewImageFromStock(gtk.STOCK_GO_DOWN, gtk.ICON_SIZE_SMALL_TOOLBAR))
bl.addBtn.Connect("clicked", bl.onAdd)
bl.delBtn.Connect("clicked", bl.onDel)
bl.upBtn.Connect("clicked", bl.onUp)
bl.downBtn.Connect("clicked", bl.onDown)
bl.delBtn.SetSensitive(false)
bl.upBtn.SetSensitive(false)
bl.downBtn.SetSensitive(false)
vbox.PackStart(bl.addBtn, false, false, 3)
vbox.PackStart(bl.delBtn, false, false, 3)
vbox.PackStart(bl.upBtn, false, false, 3)
vbox.PackStart(bl.downBtn, false, false, 3)
bl.PackStart(vbox, false, false, 0)
return bl
}
开发者ID:kch42,项目名称:biomed,代码行数:50,代码来源:biome_info_editor.go
示例18: main
func main() {
gtk.Init(&os.Args)
window := gtk.NewWindow(gtk.WINDOW_TOPLEVEL)
window.SetTitle("We love Expander")
window.Connect("destroy", gtk.MainQuit)
vbox := gtk.NewVBox(true, 0)
vbox.SetBorderWidth(5)
expander := gtk.NewExpander("dan the ...")
expander.Add(gtk.NewLabel("404 contents not found"))
vbox.PackStart(expander, false, false, 0)
window.Add(vbox)
window.ShowAll()
gtk.Main()
}
开发者ID:hauke96,项目名称:go-gtk,代码行数:17,代码来源:expander.go
示例19: main
func main() {
gtk.Init(&os.Args)
window := gtk.NewWindow(gtk.WINDOW_TOPLEVEL)
window.SetTitle("DSP Playground")
window.Connect("delete-event", deleteEvent)
window.Connect("destroy", destroyEvent)
vbox := gtk.NewVBox(true, 0)
vbox.SetBorderWidth(5)
vbox.Add(dsp_gtk.NewGraph())
window.Add(vbox)
window.SetSizeRequest(1010, 300)
window.ShowAll()
gtk.Main()
}
开发者ID:ntwyman,项目名称:go-dsp,代码行数:17,代码来源:dsp.go
示例20: guiMain
func guiMain(ch <-chan Accounts) {
glib.ThreadInit(nil)
gdk.ThreadsInit()
gdk.ThreadsEnter()
gtk.Init(&os.Args)
window := gtk.NewWindow(gtk.WINDOW_TOPLEVEL)
window.SetPosition(gtk.WIN_POS_CENTER)
window.SetTitle("password")
window.Connect("destroy", gtk.MainQuit)
entry := gtk.NewEntry()
store := gtk.NewListStore(glib.G_TYPE_STRING)
treeview := gtk.NewTreeView()
treeview.SetModel(store)
// treeview.AppendColumn(gtk.NewTreeViewColumnWithAttributes("icon", gtk.NewCellRendererPixbuf(), "pixbuf", 0))
treeview.AppendColumn(gtk.NewTreeViewColumnWithAttributes("name", gtk.NewCellRendererText(), "text", 0))
go func() {
for accounts := range ch {
gthread(func() {
store.Clear()
for _, a := range accounts {
var iter gtk.TreeIter
store.Append(&iter)
store.Set(&iter, 0, a.Name)
}
})
}
}()
swin := gtk.NewScrolledWindow(nil, nil)
swin.Add(treeview)
vbox := gtk.NewVBox(false, 0)
vbox.PackStart(entry, false, false, 1)
vbox.PackStart(swin, true, true, 0)
window.Add(vbox)
window.SetSizeRequest(460, 640)
window.SetResizable(false)
window.ShowAll()
}
开发者ID:pocke,项目名称:password,代码行数:45,代码来源:gui.go
注:本文中的github.com/mattn/go-gtk/gtk.NewVBox函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论