Jump to content

Recommended Posts

Hello all
I have a GUI with frame and buttons. How I can put WITH THIS CODE combobox to this frame?

image.png.f1d72acdc9698ded763318c8dff74f8d.png

In the marked in red region?

 

And code:

destroy  .buttons
destroy  .combo
destroy  .combo1
toplevel .buttons
wm title .buttons "Menu"
set count 0

proc add_frame title {
  global frame count
  set bold 0
  set frame .buttons.frame$count
  frame $frame -border 5 -relief groove 
  label $frame.label -text $title -font "arial 10 bold" -foreground red 
  pack  $frame       -side left -padx 2 -pady 2 -anchor n -fill both
  pack  $frame.label -side top  -padx 2 -pady 2
  incr count
}
proc add_button {title command} {
  global frame count
  button $frame.$count -text $title -command $command -font "arial 10"
  pack   $frame.$count -side top -pady 1 -padx 1 -fill x
  incr count
}
add_frame  "Components view"
add_button "Show all mesh"     {}
add_button "Hide all mesh"     {}
add_button "Show all elements"              { }
add_button "Hide all elements"         {   }
add_button "Show surface edges" {}
add_button "22222" {}
add_button "33333" {}

add_frame  "2D Mesh ()"
add_button "Add mesh to displayed surfs"   {}

 

Share this post


Link to post
Share on other sites
25 minutes ago, tinh said:

Use pack cmd

I use 

set mylist [list C C++ Lua Tcl]
pack [ttk::combobox .s1  -textvariable combovalue -values $mylist -background yellow -font {Helvetica -18 bold} -foreground red -width 40 -justify left -state normal]
set combovalue "C"

And combobox appears on new form
But I need to add it to my frame (as buttons)
And i don't know how to do this

Share this post


Link to post
Share on other sites
7 minutes ago, tinh said:

Use your frame as parent of the combobox

Pack cmd will arrange slaves on parent by default

This works:
 

set combo1 [ttk::combobox $frame.combo1 -values $values]
pack $frame.combo1 -side top  -padx 2 -pady 2

 

tinh likes this

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
You are posting as a guest. If you have an account, please sign in.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...