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
3
votes
1 answer

Can't write into tkinter spinbox after filedialog was opened

When I open a filedialog and then write other things into root, I CAN change the spinbox value with the up and down arrows, but I can't click and write into it. What am I doing wrong here? Is this a known bug? When I don't call…
3
votes
2 answers

spin box values reflected in another spin box made by for loop

i have created spin boxes using for loop when i tried to change the value of first spin box it will also reflect in another spin box. how can i rectify it. thanks in advance for answers. from tkinter import * win =Tk() frm1 = Frame(win,bg='sky…
Venkatesh
  • 33
  • 4
2
votes
0 answers

Tkinker spinbox get

I'd like to print output value from spinbox, after clicking enter. I don't know why it is printing always value "from_" (so 1). What is the problem? Thank you. import tkinter as tk gui = tk.Tk() gui.geometry("300x390") gui.title("Test") var =…
olenka
  • 43
  • 3
1
vote
1 answer

Messagebox in ttk.Spinbox bound command causes an infinite stream of pop up windows

I am working on a personal learning project that consists in a simple GUI that generates passwords. The user can either select how many characters of each type (letters, numbers and symbols) to include in the password or simply let the application…
MrG-O-L
  • 35
  • 6
1
vote
1 answer

Python Tkinter Spinboxes return value using for loops

I'm trying to use X many spin boxes as there are items in a list - so have put them on screen using a for loop. However, I don't seem able to get them to return their value when I click a button. aStarter = ["Starter 1", "Starter 2", "Starter…
Petford
  • 13
  • 2
1
vote
0 answers

How To Set Default Value Of SpinBox In Tkinter?

I Created A Simple SpinBox : import tkinter as tk win=tk.Tk() sb=tk.SpinBox(win,from_=1,to=100) sb.pack() win.mainloop() How Can I Set A Default Value Like; In Combobox we can…
Abhimanyu Sharma
  • 858
  • 1
  • 9
  • 17
1
vote
1 answer

I want my onPressed method to open the keyboard of Spinbox

I use spinbox to set the number of break time in minutes. If you tap on the number a keyboard opens, and you can set your number. How do I open the Same keyboard of my spinbox, while pressing on the ElevatedButton? I prepared the code for testing…
Ulmer
  • 57
  • 5
1
vote
1 answer

How to capture keypress event in Tkinter?

I have a spinbox that has a values ranges from 0-366, it means it only allowed a numeric data type and a backspace. Whenever a user type a character, it automatically deleted if it not a number type. I'm from a C# background and this is my first…
Vincent
  • 145
  • 2
  • 11
1
vote
0 answers

ttk.Spinbox always highlights value

I realised that the ttk.Spinbox always seems to highlight the new value that got chosen via up or down button. Is there a way to avoid this functionality? It's possible to set selectbackground=, selectforeground=
Nummer_42O
  • 334
  • 2
  • 16
0
votes
0 answers

QML SpinBox data validation on upper range twice

I am using a spinbox on Qt (5.12) and want to avoid wrong user inputs. He can enter number between 0.01 and 89.99. I customised a spinbox to add a validator with a regexp which avoid user to insert letters for example (except the point "."). After…
Mathieu Gauquelin
  • 601
  • 11
  • 35
0
votes
0 answers

tkinter ttk spinbox in second window does not work as in the first one

My problem is, that then i open a second window with a button in the first window, the spinbox in the second window does not give an output. If i start the second one individually, it works as expectet. I used the pygub designer to design the…
hepiep
  • 9
  • 4
0
votes
0 answers

Python tkinter : how to resize widgets when i resize the screen

I'm beginner... When the code below is executed, how do I make the widgets inside increase when the screen size is increased to width? but, it couldn't resized.. Does it matter if I use either pack or grid? i can't solve it.... from tkinter import…
user
  • 1
  • 3
0
votes
0 answers

Firemonkey SpinBox is not displayed in TColumn

RAD Studio 11.2 Found how to create your cell type in this way: type TSpinBoxCell = class(TSpinBox) private ............................... protected constructor Create(AOwner: TComponent); override; end; …
0
votes
1 answer

Why isn't the variable from my spinbox returning? (python, tkinter)

import tkinter as tk from tkinter import * root = tk.Tk() root.grid() numEntry = tk.StringVar() printButton = tk.IntVar() # Check if the number submitted is zero. def checkZero(): num = numEntry.get() print("Number Inputted =",num) …
0
votes
0 answers

Can we make a tkinter spinbox return a boolean value?

I know that tkinter spinbox returns a set of values and we can use that value later by using .get method. But is it possible to create a tkinter spinbox which just returns 2 outputs (True or False) ? def apply(): if (toggle_var.get() == "ON"): …
user13831250
1
2