Questions tagged [spinbox]

A spin box— also called a spinner control—is a collective term for the combination of a text box with an up-down control. Users can click arrow buttons (the up-down control) or press the UP ARROW or DOWN ARROW key to change the value in the text box. The value ascends or descends incrementally.

Spin boxes are useful when users don’t need to see the whole range of values in order to make a selection.

Example of spin box with Java

public class CyclingSpinnerListModel extends SpinnerListModel {
    Object firstValue, lastValue;
    SpinnerModel linkedModel = null;

    public CyclingSpinnerListModel(Object[] values) {
        super(values);
        firstValue = values[0];
        lastValue = values[values.length - 1];
    }

    public void setLinkedModel(SpinnerModel linkedModel) {
        this.linkedModel = linkedModel;
    }

    public Object getNextValue() {
        Object value = super.getNextValue();
        if (value == null) {
            value = firstValue;
            if (linkedModel != null) {
                linkedModel.setValue(linkedModel.getNextValue());
            }
        }
        return value;
    }

    public Object getPreviousValue() {
        Object value = super.getPreviousValue();
        if (value == null) {
            value = lastValue;
            if (linkedModel != null) {
                linkedModel.setValue(linkedModel.getPreviousValue());
            }
        }
        return value;
    }
}

Example of spin box in python:

from tkinter import *

master = Tk()

w = Spinbox(master, from_=0, to=10)
w.pack()

mainloop()
29 questions
0
votes
0 answers

QML - SpinBox - Data validation

I have the following SpinBox model which I am trying to recreate using the new QtQuick.Control 2, because this one it's using version 1. And I've encountered some problems which I am not sure how to solve. On the validation side, I should not be…
Mircea
  • 1,671
  • 7
  • 25
  • 41
0
votes
1 answer

QML - SpinBox - how to know if it's UP or DOWN pressed

I'm trying to create a custom CustomSpinBox in QML and I want to increase or decrease the value from stepSize based on which button is going to be pressed. For example, if I am pressing the UP button I want to increase the value by X and if I am…
Mircea
  • 1,671
  • 7
  • 25
  • 41
0
votes
0 answers

my tkinter ttk.spinbox is icreasing(or decreasing) unlimitedly

I'm trying to show graph with pandas and FigureCanvasTkAgg by ttk.spinbox. my code looks like getting increse or decrease event infinitly. so if I click button for event, spinbox's value increases(or decr) until the end of it's range. but sometimes…
H.P Na
  • 1
  • 1
0
votes
0 answers

How to get Int value from spinbox to create new entries

I created a simple spin box. what I want is, as I increase or decrease the value in spin box, a new entry should be created or deleted respectively. I am not able to get the Int value from the spinbox. I tried, user_input = int(sb.get()), But this…
0
votes
1 answer

Python: Reading from a spin box numbers and do following command of one

Good Morning/Evening, I want to read a number from a spinbox, and if it is 2, it should print something. But my code does not work out. I've tried it with a slider instead of a spinbox and it worked out. But for me, it is really important to use a…
xme
  • 1
0
votes
1 answer

How to make two Spin Boxes inTkinter to work independently

I am new to Tkinter and I' m developing an app that includes 2 Spinboxes. The code is the following: from tkinter import * vals1 = [1, 3, 5, 7] vals2 = [2, 4, 6, 8, 10] root = Tk() SpB1Var = DoubleVar() SpB2Var = DoubleVar() FrInitial =…
Psiloritis
  • 17
  • 5
0
votes
2 answers

TK spinbox goes into infinite cycle of updating GUI

I cannot fix a strange behavior of spinbox. Specifically, I need to update GUI at changing the spinbox's value, by means of -command and update in it. The code a bit simplified is like: package require Tk set sv 1 ttk::spinbox .sp -from 1 -to…
Alex P
  • 96
  • 1
  • 6
0
votes
0 answers

get() error on Spinbox IntVar textvariable when using trace

I have been developing with Python / tkinter for a year and up to now found answers to all my questions on stackoverflow - thank you all. So this is my first question for which I have not found the answer... yet: To run some update processes I…
Philtao
  • 1
  • 1
0
votes
1 answer

How does one retroactively change the bounds of a tkinter Spinbox instance?

For my program I need to change the list of acceptable values based on updated information from the user. Is there any method to do that, or a property I can overwrite? I tried simply: col_spinbox.values = spin_vals where spin_vals is the tuple of…
Ryan Dempsey
  • 97
  • 1
  • 9
0
votes
1 answer

Get tkinter Spinbox value inside a function

I have to display a number of wireshark packets and the user can select the particular packet to view the information. For that, I have used one function called SelectedFilterSearch() to display packets of the selected filter. The user will select…
-1
votes
1 answer

Mouse highlighting in a Spinbox triggers unknown events

I have a Python Tkinter application which has some typical numeric spinbox widgets. When the spinbox is manipulated with arrow keys or data is simply entered, everything is normal. But if a mouse is used to highlight any of the numbers, some unknown…
Joey Riso
  • 11
  • 1
-1
votes
2 answers

How to get current spinbox 'from' and 'to' values

How to get the values of spinbox from and to in a function? sbDays=tk.Spinbox(frame,from_=0,to=366) sbDays.place(relx=initialX,rely=yDistance) sbDays.configure(validate='all',validatecommand=(windows.register(validate),'%P')) def…
Vincent
  • 145
  • 2
  • 11
-2
votes
1 answer

Dynamically adjusting floating point spinbox increment in tkinter

I want to be able to dynamically adjust the increment for my floating point numerical spinbox (spin1) below. To do so, I've created a second spin box (spin2) that has values (0.1, 0.01, 0.001, 0.0001), which determine the step size of spin1. This…
Mad Physicist
  • 107,652
  • 25
  • 181
  • 264
-2
votes
1 answer

how to set a step for increment and decrement of spinbox value in python

i have a spinbox. i want to assign a step for it that value of spinbox Instead of changing by one unit, change by the value of this step. for example the value of "from_" option is 0 and the value of "to" option is 1. i want when user click on up…
Hadi Taj
  • 71
  • 9
1
2