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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T15:36:18+00:00 2026-05-16T15:36:18+00:00

I’m very new to Python, sort of following Dive into Python 2 and wanted

  • 0

I’m very new to Python, sort of following Dive into Python 2 and wanted to dabble with some Tkinter programming. I’ve tried to make a little program that takes 3 sets of words and makes combinations of each word in the 3 sets to make keywords for websites. When I run the script, the GUI appears as expected, but I get the following error when I click on the Create Combinations button

Exception in Tkinter callback
Traceback (most recent call last):
  File "/usr/lib/python2.6/lib-tk/Tkinter.py", line 1413, in __call__
    return self.func(*args)
  File "combomaker.py", line 34, in makeCombinations
    primaryraw = primaryKeyWordsBox.get()
AttributeError: 'NoneType' object has no attribute 'get'

The code I’m trying to fix

#!/usr/bin/env python
from Tkinter import *

primaryKeyWordsLabel = None
primaryKeyWordsBox = None
secondaryKeyWordsLabel = None
secondaryKeyWordsBox = None
tertiaryKeyWordsLabel = None
tertiaryKeyWordsBox = None

class Application(Frame):
 def __init__(self, master=None, padx = 10, pady= 10):
  Frame.__init__(self, master)
  self.grid()
  self.createWidgets()

 def createWidgets(self):
  self.primaryKeyWordsLabel = LabelFrame(text="Primary Key Words", padx=10, pady=10)
  self.primaryKeyWordsLabel.grid()
  self.primaryKeyWordsBox = Text(primaryKeyWordsLabel, autoseparators=True, height=5, undo=True)
  self.primaryKeyWordsBox.grid()
  self.secondaryKeyWordsLabel = LabelFrame(text="Secondary Key Words", padx=10, pady=10)
  self.secondaryKeyWordsLabel.grid()
  self.secondaryKeyWordsBox = Text(secondaryKeyWordsLabel, autoseparators=True, height=5, undo=True)
  self.secondaryKeyWordsBox.grid()
  self.tertiaryKeyWordsLabel = LabelFrame(text="Tertiary Key Words", padx=10, pady=10)
  self.tertiaryKeyWordsLabel.grid()
  self.tertiaryKeyWordsBox = Text(tertiaryKeyWordsLabel, autoseparators=True, height=5, undo=True)
  self.tertiaryKeyWordsBox.grid()
  self.goButton = Button(text="Create Combinations", command=makeCombinations)
  self.goButton.grid()

def makeCombinations():
  primaryraw = primaryKeyWordsBox.get()
  primary = primaryraw.split(', ')
  secondaryraw = secondaryKeyWordsBox.get()
  secondary = secondaryraw.split(', ')
  tertiaryraw = tertiaryKeyWordsBox.get()
  tertiary = tertiaryraw.split(', ')
  output=[]
  filename = "output.txt" 
  for i in range(len(primary)):
   for j in range(len(secondary)):
    for k in range(len(tertiary)):
     rawcombo=str(primary[i])+" "+str(secondary[j])+" "+str(tertiary[k])
     output.append(rawcombo)
  FILE = open(filename, w)
  for combo in output:
   FILE.write(combo+",\n")
  FILE.close()
app = Application()                    
app.master.title("Keyword Generator") 
app.mainloop()    

I may have thrown myself into GUI programming too fast, this is my first attempt at any GUI work but not my first time programming.
Many thanks in advance 🙂

  • 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-05-16T15:36:19+00:00Added an answer on May 16, 2026 at 3:36 pm

    You’re trying to access

    primaryKeyWordsBox
    

    outside the class Application in the (free) function makeCombinations(..).

    You could make makeCombinations(..) a member of Application by indenting it like the other member functions and add the self argument:

     def makeCombinations(self):
    

    You should modify the binding of the makeCombinations(..) to the button:

    ...,command = self.makeCombinations)
    

    Then you’ll have to add self. when you’re trying to access the members of this class:

     primaryraw = self.primaryKeyWordsBox.get(1.0,END)
     ...
     secondaryraw = self.secondaryKeyWordsBox.get(1.0,END)
     ...
     tertiaryraw = self.tertiaryKeyWordsBox.get(1.0,END)
    

    (I found the examples how to use get here).

    If you want to open a file for writing, you should do:

     FILE = open(filename, "w")
    

    instead of

     FILE = open(filename, w)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 509k
  • Answers 509k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer You need to retain your NSArray somewhere before passing it… May 16, 2026 at 4:36 pm
  • Editorial Team
    Editorial Team added an answer PHP page which will then parse the data and CURL… May 16, 2026 at 4:36 pm
  • Editorial Team
    Editorial Team added an answer You should be using LocalDate for the date and LocalTime… May 16, 2026 at 4:36 pm

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have just tried to save a simple *.rtf file with some websites and
I ran into a problem. Wrote the following code snippet: teksti = teksti.Trim() teksti
this is what i have right now Drawing an RSS feed into the php,
I have a jquery bug and I've been looking for hours now, I can't
Seemingly simple, but I cannot find anything relevant on the web. What is the
Does anyone know how can I replace this 2 symbol below from the string
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I want to count how many characters a certain string has in PHP, but

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.