Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7787151
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T20:34:16+00:00 2026-06-01T20:34:16+00:00

I cannot update the rows in Tkinter. If I set the rows to a

  • 0

I cannot update the rows in Tkinter.

If I set the rows to a regular variable it doesn’t not update. this is shown in the first script.
If I set the rows to the IntVar type like you would do with text it refuses the data type. This is shown in the second script.

2 things to note:
If you watch the counter in script 1, its going up just fine but its not being applied.
If you use self.activeRow.get() instead of self.activeRow it will effectively turn it into a normal variable with the same results shown in script 1.

Script 1

from tkinter import *

class Example(Frame):

    def move(self):
        self.activeRow += 1
        print(self.activeRow)

    def __init__(self, parent):
        Frame.__init__(self, parent)   
        self.parent = parent
        self.initUI()

    def initUI(self):

        self.columnconfigure(0, pad=0)      
        self.columnconfigure(1, pad=0)
        self.columnconfigure(2, pad=0) 
        self.rowconfigure(0, pad=0)
        self.rowconfigure(1, pad=0)
        self.rowconfigure(2, pad=0)

        Label(self, text= 'row 0').grid(row=0, column=0)
        Label(self, text= 'row 1').grid(row=1, column=0)
        Label(self, text= 'row 2').grid(row=2, column=0)

        #regular variable
        self.activeRow = 0
        b = Button(self, text="normal variable {0}".format(self.activeRow), command=self.move)
        b.grid(row=self.activeRow, column=1)


        self.pack()




def main():
    root = Tk()
    app = Example(root)
    root.mainloop()  


if __name__ == '__main__':
    main()  

Script 2

from tkinter import *

class Example(Frame):

    def move(self):
        self.activeRow.set(self.activeRow.get() + 1)
        print(self.activeRow.get())

    def __init__(self, parent):
        Frame.__init__(self, parent)   
        self.parent = parent
        self.initUI()

    def initUI(self):

        self.columnconfigure(0, pad=0)      
        self.columnconfigure(1, pad=0)
        self.columnconfigure(2, pad=0) 
        self.rowconfigure(0, pad=0)
        self.rowconfigure(1, pad=0)
        self.rowconfigure(2, pad=0)

        Label(self, text= 'row 0').grid(row=0, column=0)
        Label(self, text= 'row 1').grid(row=1, column=0)
        Label(self, text= 'row 2').grid(row=2, column=0)

        #Tkinter IntVar
        self.activeRow = IntVar()
        self.activeRow.set(0)


        b = Button(self, text="IntVar", command=self.move)
        b.grid(row=self.activeRow, column=1)


        self.pack()
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T20:34:18+00:00Added an answer on June 1, 2026 at 8:34 pm

    If you want to move an existing widget, you have to call again the grid method to update this widget (ie widget.grid(row=other_value)). To remove a widget, you can use the grid_forget() method.

    from Tkinter import *
    
    class Example(Frame):
        def __init__(self, parent):
            Frame.__init__(self, parent)
            self.initUI()
    
        def move(self):
            info = self.b.grid_info()
            previous_row = int(info["row"]) #int() needed because datas are stored as string
            self.b.grid(row=previous_row+1)
    
        def initUI(self):
            for i in range(5):
                l = Label(self, text="Row {0}".format(i))
                l.grid(row=i, column=0)
    
            self.b =  Button(self, text="Moving button", command=self.move)
            self.b.grid(row=0, column=1)
    
            self.pack()
    
    root = Tk()
    app = Example(root)
    root.mainloop()
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Update: looks like this is indeed a WiX limitation - Cannot add 64bit com+
Assuming that I cannot run something like this with Fabric: run(svn update --password 'password'
A puzzler from a coworker that I cannot figure out... update btd.dbo.tblpayroll set empname
This is basically an extension of Update multiple rows with one query? . I
I cannot update created previously entity. I'm getting a StaleObjectException exception with message: Row
i want to update my sqlite database but i cannot find the way to
After update our iphone app can not access the keychain. The distribution certificate has
I am trying to set some id's for a bunch of rows in a
I'm working on OSGI bundle which uses JDBC connection in order to update rows
Is there a way without using a script to run an UPDATE that won't

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.