tkinter - How to divide two user inputs? Python 3.3 -


I am creating a simple countdown clock at this level I have my GUI (I have already programmed) I want to take two user entries and want to do the value_a / value_b operation.

Every time I do this I get type code: type / unsupported operand type (s) for: 'intervara' and 'interver'

Here is the question in question:

  def mineTime (): mtime = ueAV / ueMY label_mtime = Label (text = mtime, fg = 'white', bg = 'gray'). Pack () Return # GUI object mGui = Tk () ueAV = IntVar () ueMY = IntVar ()   

Any help will be highly appreciated!

As with this example, use IntVar.get () method < / P>

  mtime = ueAV.get () / ueMY.get ()   

You probably want to convert to the first float if you are on Python 2 Or it will only complete the integer division.

  mtime = float (ueAV.get ()) / UeMY.get ()   

As a result, you change the result for the label into text This line needs to be changed

  label (text = str (mtime), fg = 'white', bg = 'gray'). Pack ()    

Comments

Popular posts from this blog

excel vba - How to delete Solver(SOLVER.XLAM) code -

github - Teamcity & Git - PR merge builds - anyway to get HEAD commit hash? -

ios - Replace text in UITextView run slowly -