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 8274873
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T07:52:49+00:00 2026-06-08T07:52:49+00:00

I am redesigning the layout for a interface using python 2.6 and the standard

  • 0

I am redesigning the layout for a interface using python 2.6 and the standard Tkinter included with it. Trouble is that I am noticing some strange behavior, and I am new to Tkinter so this may just be something simple I am overlooking due to inexperience.

Here is some example code of how I am nesting frames inside a master frame in order to get the desired layout:

import Tkinter as tk

root = tk.Tk()

master = tk.Frame(root)

frame = tk.Frame(master).grid(sticky = tk.W)

item1 = "Label One"
L1 = tk.Label(frame, text = item1).grid(sticky = tk.W)

b1 = tk.Button(frame, text = "Button 1").grid(sticky = tk.W)

find = tk.Label(frame, text = "Find").grid(sticky = tk.W)

item = tk.Entry(frame, width = 50).grid(sticky = tk.W)
##item.insert(0,"Enter Item to Search For")

L2 = tk.Label(frame, text = "Label Two").grid(sticky = tk.W)

search = tk.Button(frame, text = "Search").grid(row = 3, column = 0)

frame2 = tk.Frame(master).grid(sticky = tk.W)

list1 = tk.Listbox(frame2, width = 100).grid(sticky = tk.W)

##yscroll = tk.Scrollbar(frame2,orient = tk.VERTICAL,command = list1.yview).grid(row = 5, column = 1, sticky = tk.N + tk.S + tk.W)
yscroll = tk.Scrollbar(frame2, orient = tk.VERTICAL).grid(row = 5, column = 1, sticky = tk.N + tk.S + tk.W)
##list1.configure(yscrollcommand = yscroll.set)

##xscroll = tk.Scrollbar(frame2, orient = tk.HORIZONTAL, command = list1.xview).grid(sticky = tk.W + tk.E)
xscroll = tk.Scrollbar(frame2, orient = tk.HORIZONTAL).grid(sticky = tk.W + tk.E)
##list1.configure(xscrollcommand = xscroll.set)

root.mainloop()

This following error occurs when I try to insert a default value in the entry widget, and it worked before I started nesting frames:

Traceback (most recent call last):
   File "H:\Tkinter\Grid.py", line 17, in <module>
    item.insert(0,"Enter Item to Search For")
AttributeError: 'NoneType' object has no attribute 'insert'

Similiar errors occur on all the commented out lines in the example code.These are actions I need to perfrom because currently the scrollbars are not going to work because I can’t tell them to change the list when scrolling.

1.When you nest frames like this do I have to access the variables of the widgets in a different manner?

2.When I am using nested frames and both the children and the parent are using a grid, why would my widgets placement correspond to just the master’s row and column count? If you look at the line for the Y-axis scroll bar I had to do row = 5, col = 1 of the master. I believe it should be row 0, col 1 of frame2, because the widget has the parent set as frame2 and I wanted frame2 to use a grid as well, but it seems to use the master frames grid.

3.Is it possible to display the gridlines in the different frames?

  • 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-08T07:52:51+00:00Added an answer on June 8, 2026 at 7:52 am

    When using Tkinter, you shouldn’t create an object and grid it at the same time.

    bad = tk.Button(frame).grid()  #"bad" is None since .grid returns None
    
    good = tk.Button(frame)
    good.grid()
    

    And to get at the information (e.g. cell) for a particular gridded widget, you probably want to use the grid_info method.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

we at our company are trying out some new technologies so thought of redesigning
I'm redesigning a web site that has a bunch of tags in the content
We are using twitter bootstrap to do some redesign of our site. The issue
I am redesigning a .NET system that stores >1000 multipage .TIF images per day
I am redesigning my website and in the process restructuring some of the linking
I'm the processing of redesigning a website that uses hover effect on a button
I'm redesigning site that use CakePHP, and till now everything goes well because I
So, I am writing some sort of a statistics program (actually I am redesigning
I am redesigning a new website and my database table need tidying up a
I'm redesigning the templates for our online store (Using Castle Monorail with the NVelocity

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.