Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

display many scale....

Status
Not open for further replies.

sl1200mk2

Technical User
Jun 7, 2005
39
FR
hi all
i've got a script who create x scale (depends of demand)
i would like to display 10 scale per lines.
if i ask for 15 scale, i would like to display 10 and 5 under the 10
if i ask for 100, i would like to display 10 rang og 10 scale

here's my code

frame .0
pack .0 -side left -fill x

set f 0
set circ {}

frame .top -borderwidth 10
pack .top -side left -fill x

spinbox .top.circ -textvariable circ -from 0 -to 512 -increment 1 -width 5
bind .top.circ <Return> {focus .top}

canvas .top.z -width [expr $circ*100] -height [expr $circ*200]

button .top.go -text "go" -width 5 -height 3 -borderwidth 20 -command {

while {$f<$circ} {
scale .top.z.$f -orient vertical -from 100 -to 0 -length 150 -width 10 -variable sub$f -command [list scale_command sub$f]
pack .top.z.$f -side left
incr f
} }

proc scale_command {name value} {
pd_send "/$name $value;"
}
pack .top.circ .top.go .top.z


thank you for the help
nico
 
why can't you just pack multipe scale widgets as you like?

_________________
Bob Rashkin
rrashkin@csc.com
 
because i don't succeed
i've tried with that

if {$count > $l } {
pack configure .top.z.$count -after .z.$count
pack .top.z.$count -side left
}

after 10 scale, scale create again from the left side of the window,
but i don't succeed with 25 scale for example

also, pack is a little bit mysterious for me....
i don't know how to display
10 scale (horizontaly)
10 scale (horizontaly)
10 scale (horizontaly)
10 scale (horizontaly)
10 scale (horizontaly)

i think it's a pack problem but i don't solve it...
best regards
nico
 
Code:
pack [frame .1] -side top
pack [scale .1.s1 -orient horizontal -from 0 -to 12 -tickinterval 3] -side top
pack [scale .1.s2 -orient horizontal -from 0 -to 48 -tickinterval 6] -side top
pack [scale .1.s3 -orient horizontal -from 0 -to 96 -tickinterval 12] -side top

_________________
Bob Rashkin
rrashkin@csc.com
 
well, in fact
i enter 15 in the spinbox, i click "go" button
it create scale vertically but like that
| | | | | | | | | |
| | | | | | | | | |
| | | | | | | | | |

|
| <-- is a scale
|

and after i would like the 5 other scale to be packed under the ten first

and if i ask for 100 scale, i would like them to have 10 ranks of 10 scale...

sorry for my lack of knowledge

nico
 
Well, there's only so many scale widgets you can pack. More importantly, why are you using scales. The scale widget is really a slider; pack them to tight and there's nothing to slide. Why don't you use a label widget that you prepare before hand to have the correct markings?

_________________
Bob Rashkin
rrashkin@csc.com
 
hi bong
i'm not sure to understand what you say...

the goal of the scale is to display a value received from another program (using socket command)
so in this way, ok to use label to display the data - i've got still the problem of dipatch them in the space.....

but i use the same scale (with a <ButtonPress-1><Motion> binding to send value to the other programm (the name of the program is PureData))

so:
i can replace the scale with rectangle canvas wich send incrementing value when you click in and moveup or down the mouse.
but i don't know how to do that.....

to clarify your post, am i able to display 200 slider? or i will get problems

thanks
nico

 
I'm still not sure what you're trying to do. Could you explain again what the user should see, do, and expect?

_________________
Bob Rashkin
rrashkin@csc.com
 
at the window creation, the user see
1 spinbox
1 go button

he enter a number (X) and click on go

(X) scale appears, one by one (with the after command)
when there's 10 scale, the others appears under the ten first (like with a end of line with a typewriter)
and so on

scale are packed by ten on a line
there's (x)/10 line --- if the user ask for 50 scale, there'll be 5 lines of 10 scale

sorry for my bad english
....
 
OK. Let's try something simpleminded. Here is a simple implementation of what I think you are describing. Look at this and tell me what it does not do that you want done:
Code:
#simple minded multi-scale
#a frame for the controls
pack [frame .1 -borderwidth 4] -side top
#add the controls
pack [spinbox .1.s -textvariable circ -from 0 -to 512] -side left
pack [button .1.b -text go -command {MakeScales $circ}] -side left -padx 8

proc MakeScales {circ} {
    #a frame for the scales
    destroy .2
    pack [frame .2 -borderwidth 4] -side top
     set numRows [expr {$circ/10}]
     set rmndr [expr {$circ%10}]
     pack [frame .2.r] -side bottom
     for {set i 0} {$i<$rmndr} {incr i} {
         pack [scale .2.r.s$i -variable subR$i] -side left
      }
     for {set r 0} {$r<$numRows} {incr r} {
         pack [frame .2.$r] -side bottom
         for {set i 0} {$i<10} {incr i} {
             pack [scale .2.$r.$i -variable sub$r$i] -side left
         }
     }
}

_________________
Bob Rashkin
rrashkin@csc.com
 
!!!!!!!!! WELL DONE MISTER BONG !!!!!!!!!!!

it's exactly want i want.
exactly
exactly

i'll look your code to understand it more

many thanks
best regards
nico

ps: a new question arrive.....
++++++++
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top