combobox

AlexanderP
AlexanderP Altair Community Member
edited October 2020 in Community Q&A

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'   {}

 

Answers

  • tinh
    tinh Altair Community Member
    edited March 2019

    Use cmd ttk::combobox

  • AlexanderP
    AlexanderP Altair Community Member
    edited March 2019

    Use cmd ttk::combobox

    I know about this command
    But I can't place combobox to frame

  • tinh
    tinh Altair Community Member
    edited March 2019

    Use pack cmd

  • AlexanderP
    AlexanderP Altair Community Member
    edited March 2019

    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

  • tinh
    tinh Altair Community Member
    edited March 2019

    Use your frame as parent of the combobox

    Pack cmd will arrange slaves on parent by default

  • AlexanderP
    AlexanderP Altair Community Member
    edited March 2019

    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