Configuración del tamaño de la barra de desplazamiento

I'm new in Python, and I have (maybe) easy question, dealing with scrollbars. I've built a prog which allows me to change my plot by moving the frequency using a scroll. But, it will be useful to have a huger scroll in the x direction.

So here my question: how setting the scrollbar size?

Here the part concerned :

def __init__(self, master):
    self.master = master
    self.fig = Figure(figsize=(5,4), dpi=100)
    self.myplot = self.fig.add_subplot(111)
    self.myplot.axis('equal')

    self.canvas = FigureCanvasTkAgg(self.fig, master=master)
    self.canvas.show()
    self.canvas.get_tk_widget().pack(side=TOP, fill=BOTH, expand=1)

    self.toolbar = NavigationToolbar2TkAgg( self.canvas, master )
    self.toolbar.update()
    self.canvas._tkcanvas.pack(side=TOP, fill=BOTH, expand=1)

    self.button = Button(master=root, text='Quit', command=self.quit_App)
    self.button.pack(side=BOTTOM)

    self.freq_label = Label(master, text="Frequency: ")
    self.freq_label.pack(side=TOP)
    self.scrollbar = Scrollbar(master, orient = HORIZONTAL)
    self.scrollbar.pack(side=LEFT, fill = X)                              
    self.scrollbar.config(command=self.slider_update)`

Gracias por ayudarme !

preguntado el 31 de enero de 12 a las 16:01

What GUI toolkit are you using? What kind of scrollbar? We need more information to answer this question. I would suggest posting code. -

You should give more information. scrollbar is not a python keyword, so probably you are refering to some undisclosed GUI library. If you want to share its name and some code with us we will help you better -

In Python, when in doubt, assume TkInter. They insist on keeping it in there, thus it is the anointed (default) toolkit. ... Yeah, I hate it. -

When you say "size", do you mean width, height, handle length, ...? -

Just to counter @Mike DeSimone and keep the universe in balance, I love tkinter! I recently switched an app from wxPython to tkinter and coding suddenly got a whole lot easier. Keeping it in the python core continues to be a wise decision IMHO. -

1 Respuestas

Scrollbars are designed to scroll, and typically have a thumb size that is determined by the relative amount of data that is visible. Since you are controlling a plot rather than scrolling, have you considered using a scale widget instead?

Puedes ver un example of a scale widget at tkdocs.com, and find documentation on the scale widget at effbot.org, amoung other places.

Respondido 01 Feb 12, 04:02

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.