3 Replies - 410 Views - Last Post: 13 April 2013 - 10:54 AM Rate Topic: -----

#1 jblankinship  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 7
  • Joined: 07-October 12

Spinbox default value

Posted 13 April 2013 - 08:28 AM

I am creating a GUI using Tkinter. I am wondering if there is a way to set the default value of a spinbox?

self.spnWeight = Spinbox(self, width = 5, state = "readonly", from_= 50, to = 400).selection_element(element = 185)
self.spnWeight.grid(row = 3, column = 2)



I would like the spinbox to default to 185 and the user can scroll up or down to select a value between 50 and 400.

Sorry my code is
self.spnWeight = Spinbox(self, width = 5, state = "readonly", from_= 50, to = 400)
self.spnWeight.grid(row = 3, column = 2)


I was trying to work with the selection method but wasn't getting anywhere.

Is This A Good Question/Topic? 0
  • +

Replies To: Spinbox default value

#2 andrewsw  Icon User is online

  • Fire giant boob nipple gun!
  • member icon

Reputation: 2890
  • View blog
  • Posts: 9,599
  • Joined: 12-December 12

Re: Spinbox default value

Posted 13 April 2013 - 09:06 AM

Never used it myself, but maybe:

spnWeight.delete(50, "end")
spnWeight.insert(50, 185)

This post has been edited by andrewsw: 13 April 2013 - 09:06 AM

Was This Post Helpful? 0
  • +
  • -

#3 jblankinship  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 7
  • Joined: 07-October 12

Re: Spinbox default value

Posted 13 April 2013 - 09:27 AM

Basically all that does is remove the values 50 thru end (which is 400) then inserts the values 50 thru 185. This gives me a spin box that starts at 50 and goes to 185. Not what I am trying to do. I want the GUI to show the value of 185 when the program is executed and the user to be able to scroll through the original values of 50 to 400.
Was This Post Helpful? 0
  • +
  • -

#4 woooee  Icon User is offline

  • D.I.C Head

Reputation: 15
  • View blog
  • Posts: 68
  • Joined: 21-November 12

Re: Spinbox default value

Posted 13 April 2013 - 10:54 AM

A Listbox has a "see(index)" method which will do that but a Spinbox has nothing that I know about.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1