How to display a scale or vscale in GTK-3 with Python

Viewed 158

I have code that displays a VScale, sort of. The widget shows with a number indicating the current value. It responds to page up events by changing the value. However, there is no slider.There is just a small circle. How can I get it to display properly so that the user can adjust the value by dragging the slider?

enter image description here

Here is my code:

class ThresholdingWindow(SuperClass):
    def __init__(self, parent, controller):
        super(ThresholdingWindow, self).__init__(parent, controller)
        self.set_title("Thresholding")

        self.controller = controller

        button = Gtk.Button.new_with_label("Apply")
        self.box.pack_start(button, True, True, 0)

        button2 = Gtk.Button.new_with_label("Back to Main")
        button2.connect("clicked", self.on_back_clicked)
        self.box.pack_start(button2, True, True, 0)

        adjustment = Gtk.Adjustment(0.0,0.0,1.0,.01,.02)
        # scale = Gtk.Scale.new(Gtk.Orientation.VERTICAL, adjustment)
        scale = Gtk.VScale.new(adjustment)
        scale.set_digits(3)
        # scale = Gtk.VScale(adjustment)
        self.box.pack_start(scale, False, False,0)
        
1 Answers

Found on stackoverflow:

        scale.set_size_request(30,100)

It seems that there wasn't enough "real estate" on the screen to accommodate the slider.

Related