Why is Tkinter Entry's get function returning nothing?Python tkinter's entry.get() does not work, how can I fix it?Entry is returning nothing.get() not giving a value'get' returning blank value pythonEntry data manipulation difficultiesWhy am a taking zero division error without divide by 0?How to check if a password is correctWhat is wrong with this code in python tk for prime factorizations of integers, and how to make it right?Passing Entry StringVariable text via Button command not workingGet contents of a Tkinter Entry widgetHow do I return multiple values from a function?Peak detection in a 2D arrayttk tkinter multiple frames/windowsWhy does Python code run faster in a function?Problems with get() for Tkinter widgets“Large data” work flows using pandasWhy does “not(True) in [False, True]” return False?Python>tkinter: How to get values from a panel inside a notebook frameTkinter Printing an error code to a label from a functionInteractively validating Entry widget content in tkinter (part 2 - change the properties of the entry object)

How do I explain that I don't want to maintain old projects?

Taking my Ph.D. advisor out for dinner after graduation

Why do airports remove/realign runways?

Use ContourPlot data in ParametricPlot

How can I understand if an object stay (zero velocity) or moving with constant velocity (zero acceleration)

What does "spinning upon the shoals" mean?

What are some bad ways to subvert tropes?

3-way switches no longer serving their purpose

In layman's terms, does the Luckstone just give a passive +1 to all d20 rolls and saves except for death saves?

This LM317 diagram doesn't make any sense to me

What are the consequences for a developed nation to not accept any refugee?

What is the highest level of accuracy in motion control a Victorian society could achieve?

Sorting a list according to some pre-specified rules

What are the effects of abstaining from eating a certain flavor?

Interpretation of non-significant results as "trends"

Gory anime with pink haired girl escaping an asylum

Did William Shakespeare hide things in his writings?

Why do people prefer metropolitan areas, considering monsters and villains?

Uniform initialization by tuple

Tesco's Burger Relish Best Before End date number

Why did Robert F. Kennedy loathe Lyndon B. Johnson?

How can I reset Safari when Safari is broken?

Which is a better conductor, a very thick rubber wire or a very thin copper wire?

What purpose does mercury dichloride have in fireworks?



Why is Tkinter Entry's get function returning nothing?


Python tkinter's entry.get() does not work, how can I fix it?Entry is returning nothing.get() not giving a value'get' returning blank value pythonEntry data manipulation difficultiesWhy am a taking zero division error without divide by 0?How to check if a password is correctWhat is wrong with this code in python tk for prime factorizations of integers, and how to make it right?Passing Entry StringVariable text via Button command not workingGet contents of a Tkinter Entry widgetHow do I return multiple values from a function?Peak detection in a 2D arrayttk tkinter multiple frames/windowsWhy does Python code run faster in a function?Problems with get() for Tkinter widgets“Large data” work flows using pandasWhy does “not(True) in [False, True]” return False?Python>tkinter: How to get values from a panel inside a notebook frameTkinter Printing an error code to a label from a functionInteractively validating Entry widget content in tkinter (part 2 - change the properties of the entry object)






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








18















I'm trying to use an Entry field to get manual input, and then work with that data.



All sources I've found claim I should use the get() function, but I haven't found a simple working mini example yet, and I can't get it to work.



I hope someone can tel me what I'm doing wrong. Here's a mini file:



from tkinter import *


master = Tk()

Label(master, text="Input: ").grid(row=0, sticky=W)

entry = Entry(master)
entry.grid(row=0, column=1)

content = entry.get()
print(content) # does not work

mainloop()


This gives me an Entry field I can type in, but I can't do anything with the data once it's typed in.



I suspect my code doesn't work because initially, entry is empty. But then how do I access input data once it has been typed in?










share|improve this question
























  • In your example, what exactly are you expecting? You haven't given the entry widget any text before you call get so of course it returns an empty string.

    – Bryan Oakley
    May 23 '12 at 22:51


















18















I'm trying to use an Entry field to get manual input, and then work with that data.



All sources I've found claim I should use the get() function, but I haven't found a simple working mini example yet, and I can't get it to work.



I hope someone can tel me what I'm doing wrong. Here's a mini file:



from tkinter import *


master = Tk()

Label(master, text="Input: ").grid(row=0, sticky=W)

entry = Entry(master)
entry.grid(row=0, column=1)

content = entry.get()
print(content) # does not work

mainloop()


This gives me an Entry field I can type in, but I can't do anything with the data once it's typed in.



I suspect my code doesn't work because initially, entry is empty. But then how do I access input data once it has been typed in?










share|improve this question
























  • In your example, what exactly are you expecting? You haven't given the entry widget any text before you call get so of course it returns an empty string.

    – Bryan Oakley
    May 23 '12 at 22:51














18












18








18


7






I'm trying to use an Entry field to get manual input, and then work with that data.



All sources I've found claim I should use the get() function, but I haven't found a simple working mini example yet, and I can't get it to work.



I hope someone can tel me what I'm doing wrong. Here's a mini file:



from tkinter import *


master = Tk()

Label(master, text="Input: ").grid(row=0, sticky=W)

entry = Entry(master)
entry.grid(row=0, column=1)

content = entry.get()
print(content) # does not work

mainloop()


This gives me an Entry field I can type in, but I can't do anything with the data once it's typed in.



I suspect my code doesn't work because initially, entry is empty. But then how do I access input data once it has been typed in?










share|improve this question
















I'm trying to use an Entry field to get manual input, and then work with that data.



All sources I've found claim I should use the get() function, but I haven't found a simple working mini example yet, and I can't get it to work.



I hope someone can tel me what I'm doing wrong. Here's a mini file:



from tkinter import *


master = Tk()

Label(master, text="Input: ").grid(row=0, sticky=W)

entry = Entry(master)
entry.grid(row=0, column=1)

content = entry.get()
print(content) # does not work

mainloop()


This gives me an Entry field I can type in, but I can't do anything with the data once it's typed in.



I suspect my code doesn't work because initially, entry is empty. But then how do I access input data once it has been typed in?







python python-3.x tkinter get tkinter-entry






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Aug 31 '17 at 18:36









Cœur

21.3k10 gold badges121 silver badges168 bronze badges




21.3k10 gold badges121 silver badges168 bronze badges










asked May 23 '12 at 20:12









CodingCatCodingCat

2,5015 gold badges27 silver badges38 bronze badges




2,5015 gold badges27 silver badges38 bronze badges












  • In your example, what exactly are you expecting? You haven't given the entry widget any text before you call get so of course it returns an empty string.

    – Bryan Oakley
    May 23 '12 at 22:51


















  • In your example, what exactly are you expecting? You haven't given the entry widget any text before you call get so of course it returns an empty string.

    – Bryan Oakley
    May 23 '12 at 22:51

















In your example, what exactly are you expecting? You haven't given the entry widget any text before you call get so of course it returns an empty string.

– Bryan Oakley
May 23 '12 at 22:51






In your example, what exactly are you expecting? You haven't given the entry widget any text before you call get so of course it returns an empty string.

– Bryan Oakley
May 23 '12 at 22:51













4 Answers
4






active

oldest

votes


















32














It looks like you may be confused as to when commands are run. In your example, you are calling the get method before the GUI has a chance to be displayed on the screen (which happens after you call mainloop.



Try adding a button that calls the get method. This is much easier if you write your application as a class. For example:



import tkinter as tk

class SampleApp(tk.Tk):
def __init__(self):
tk.Tk.__init__(self)
self.entry = tk.Entry(self)
self.button = tk.Button(self, text="Get", command=self.on_button)
self.button.pack()
self.entry.pack()

def on_button(self):
print(self.entry.get())

app = SampleApp()
app.mainloop()


Run the program, type into the entry widget, then click on the button.






share|improve this answer

























  • Ah, I see. I'm not really firm on classes yet (still very much a beginner at programming in general), but I see the problem. I'll just make an "Analyze!" button and put the get()-function in there, that should work. Thank you!

    – CodingCat
    May 24 '12 at 7:21







  • 1





    You might need to add self as a parameter while calling the superclass init: tk.Tk.__init__(self). Otherwise, very useful example!

    – Deep-B
    Mar 22 '14 at 23:56











  • @Deep-B: thanks for catching that.

    – Bryan Oakley
    Mar 23 '14 at 0:37











  • And, er, you misspelt app in the last line. <_<"

    – Deep-B
    Mar 23 '14 at 0:41


















7














You could also use a StringVar variable, even if it's not strictly necessary:



v = StringVar()

e = Entry(master, textvariable=v)
e.pack()

v.set("a default value")
s = v.get()


For more information, see this page on effbot.org.






share|improve this answer




















  • 1





    A StringVar isn't necessary, strictly speaking. They are handy, but for this question they are completely superfluous.

    – Bryan Oakley
    May 23 '12 at 23:03



















3














A simple example without classes:



from tkinter import * 
master = Tk()

# Create this method before you create the entry
def return_entry(en):
"""Gets and prints the content of the entry"""
content = entry.get()
print(content)

Label(master, text="Input: ").grid(row=0, sticky=W)

entry = Entry(master)
entry.grid(row=0, column=1)

# Connect the entry with the return button
entry.bind('<Return>', return_entry)

mainloop()





share|improve this answer






























    1














    *



    master = Tk()
    entryb1 = StringVar

    Label(master, text="Input: ").grid(row=0, sticky=W)

    Entry(master, textvariable=entryb1).grid(row=1, column=1)

    b1 = Button(master, text="continue", command=print_content)
    b1.grid(row=2, column=1)

    def print_content():
    global entryb1
    content = entryb1.get()
    print(content)

    master.mainloop()


    What you did wrong was not put it inside a Define function then you hadn't used the .get function with the textvariable you had set.






    share|improve this answer



























      Your Answer






      StackExchange.ifUsing("editor", function ()
      StackExchange.using("externalEditor", function ()
      StackExchange.using("snippets", function ()
      StackExchange.snippets.init();
      );
      );
      , "code-snippets");

      StackExchange.ready(function()
      var channelOptions =
      tags: "".split(" "),
      id: "1"
      ;
      initTagRenderer("".split(" "), "".split(" "), channelOptions);

      StackExchange.using("externalEditor", function()
      // Have to fire editor after snippets, if snippets enabled
      if (StackExchange.settings.snippets.snippetsEnabled)
      StackExchange.using("snippets", function()
      createEditor();
      );

      else
      createEditor();

      );

      function createEditor()
      StackExchange.prepareEditor(
      heartbeatType: 'answer',
      autoActivateHeartbeat: false,
      convertImagesToLinks: true,
      noModals: true,
      showLowRepImageUploadWarning: true,
      reputationToPostImages: 10,
      bindNavPrevention: true,
      postfix: "",
      imageUploader:
      brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
      contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
      allowUrls: true
      ,
      onDemand: true,
      discardSelector: ".discard-answer"
      ,immediatelyShowMarkdownHelp:true
      );



      );













      draft saved

      draft discarded


















      StackExchange.ready(
      function ()
      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f10727131%2fwhy-is-tkinter-entrys-get-function-returning-nothing%23new-answer', 'question_page');

      );

      Post as a guest















      Required, but never shown

























      4 Answers
      4






      active

      oldest

      votes








      4 Answers
      4






      active

      oldest

      votes









      active

      oldest

      votes






      active

      oldest

      votes









      32














      It looks like you may be confused as to when commands are run. In your example, you are calling the get method before the GUI has a chance to be displayed on the screen (which happens after you call mainloop.



      Try adding a button that calls the get method. This is much easier if you write your application as a class. For example:



      import tkinter as tk

      class SampleApp(tk.Tk):
      def __init__(self):
      tk.Tk.__init__(self)
      self.entry = tk.Entry(self)
      self.button = tk.Button(self, text="Get", command=self.on_button)
      self.button.pack()
      self.entry.pack()

      def on_button(self):
      print(self.entry.get())

      app = SampleApp()
      app.mainloop()


      Run the program, type into the entry widget, then click on the button.






      share|improve this answer

























      • Ah, I see. I'm not really firm on classes yet (still very much a beginner at programming in general), but I see the problem. I'll just make an "Analyze!" button and put the get()-function in there, that should work. Thank you!

        – CodingCat
        May 24 '12 at 7:21







      • 1





        You might need to add self as a parameter while calling the superclass init: tk.Tk.__init__(self). Otherwise, very useful example!

        – Deep-B
        Mar 22 '14 at 23:56











      • @Deep-B: thanks for catching that.

        – Bryan Oakley
        Mar 23 '14 at 0:37











      • And, er, you misspelt app in the last line. <_<"

        – Deep-B
        Mar 23 '14 at 0:41















      32














      It looks like you may be confused as to when commands are run. In your example, you are calling the get method before the GUI has a chance to be displayed on the screen (which happens after you call mainloop.



      Try adding a button that calls the get method. This is much easier if you write your application as a class. For example:



      import tkinter as tk

      class SampleApp(tk.Tk):
      def __init__(self):
      tk.Tk.__init__(self)
      self.entry = tk.Entry(self)
      self.button = tk.Button(self, text="Get", command=self.on_button)
      self.button.pack()
      self.entry.pack()

      def on_button(self):
      print(self.entry.get())

      app = SampleApp()
      app.mainloop()


      Run the program, type into the entry widget, then click on the button.






      share|improve this answer

























      • Ah, I see. I'm not really firm on classes yet (still very much a beginner at programming in general), but I see the problem. I'll just make an "Analyze!" button and put the get()-function in there, that should work. Thank you!

        – CodingCat
        May 24 '12 at 7:21







      • 1





        You might need to add self as a parameter while calling the superclass init: tk.Tk.__init__(self). Otherwise, very useful example!

        – Deep-B
        Mar 22 '14 at 23:56











      • @Deep-B: thanks for catching that.

        – Bryan Oakley
        Mar 23 '14 at 0:37











      • And, er, you misspelt app in the last line. <_<"

        – Deep-B
        Mar 23 '14 at 0:41













      32












      32








      32







      It looks like you may be confused as to when commands are run. In your example, you are calling the get method before the GUI has a chance to be displayed on the screen (which happens after you call mainloop.



      Try adding a button that calls the get method. This is much easier if you write your application as a class. For example:



      import tkinter as tk

      class SampleApp(tk.Tk):
      def __init__(self):
      tk.Tk.__init__(self)
      self.entry = tk.Entry(self)
      self.button = tk.Button(self, text="Get", command=self.on_button)
      self.button.pack()
      self.entry.pack()

      def on_button(self):
      print(self.entry.get())

      app = SampleApp()
      app.mainloop()


      Run the program, type into the entry widget, then click on the button.






      share|improve this answer















      It looks like you may be confused as to when commands are run. In your example, you are calling the get method before the GUI has a chance to be displayed on the screen (which happens after you call mainloop.



      Try adding a button that calls the get method. This is much easier if you write your application as a class. For example:



      import tkinter as tk

      class SampleApp(tk.Tk):
      def __init__(self):
      tk.Tk.__init__(self)
      self.entry = tk.Entry(self)
      self.button = tk.Button(self, text="Get", command=self.on_button)
      self.button.pack()
      self.entry.pack()

      def on_button(self):
      print(self.entry.get())

      app = SampleApp()
      app.mainloop()


      Run the program, type into the entry widget, then click on the button.







      share|improve this answer














      share|improve this answer



      share|improve this answer








      edited Mar 9 '15 at 23:15









      nbro

      6,08010 gold badges54 silver badges104 bronze badges




      6,08010 gold badges54 silver badges104 bronze badges










      answered May 23 '12 at 23:00









      Bryan OakleyBryan Oakley

      230k22 gold badges307 silver badges453 bronze badges




      230k22 gold badges307 silver badges453 bronze badges












      • Ah, I see. I'm not really firm on classes yet (still very much a beginner at programming in general), but I see the problem. I'll just make an "Analyze!" button and put the get()-function in there, that should work. Thank you!

        – CodingCat
        May 24 '12 at 7:21







      • 1





        You might need to add self as a parameter while calling the superclass init: tk.Tk.__init__(self). Otherwise, very useful example!

        – Deep-B
        Mar 22 '14 at 23:56











      • @Deep-B: thanks for catching that.

        – Bryan Oakley
        Mar 23 '14 at 0:37











      • And, er, you misspelt app in the last line. <_<"

        – Deep-B
        Mar 23 '14 at 0:41

















      • Ah, I see. I'm not really firm on classes yet (still very much a beginner at programming in general), but I see the problem. I'll just make an "Analyze!" button and put the get()-function in there, that should work. Thank you!

        – CodingCat
        May 24 '12 at 7:21







      • 1





        You might need to add self as a parameter while calling the superclass init: tk.Tk.__init__(self). Otherwise, very useful example!

        – Deep-B
        Mar 22 '14 at 23:56











      • @Deep-B: thanks for catching that.

        – Bryan Oakley
        Mar 23 '14 at 0:37











      • And, er, you misspelt app in the last line. <_<"

        – Deep-B
        Mar 23 '14 at 0:41
















      Ah, I see. I'm not really firm on classes yet (still very much a beginner at programming in general), but I see the problem. I'll just make an "Analyze!" button and put the get()-function in there, that should work. Thank you!

      – CodingCat
      May 24 '12 at 7:21






      Ah, I see. I'm not really firm on classes yet (still very much a beginner at programming in general), but I see the problem. I'll just make an "Analyze!" button and put the get()-function in there, that should work. Thank you!

      – CodingCat
      May 24 '12 at 7:21





      1




      1





      You might need to add self as a parameter while calling the superclass init: tk.Tk.__init__(self). Otherwise, very useful example!

      – Deep-B
      Mar 22 '14 at 23:56





      You might need to add self as a parameter while calling the superclass init: tk.Tk.__init__(self). Otherwise, very useful example!

      – Deep-B
      Mar 22 '14 at 23:56













      @Deep-B: thanks for catching that.

      – Bryan Oakley
      Mar 23 '14 at 0:37





      @Deep-B: thanks for catching that.

      – Bryan Oakley
      Mar 23 '14 at 0:37













      And, er, you misspelt app in the last line. <_<"

      – Deep-B
      Mar 23 '14 at 0:41





      And, er, you misspelt app in the last line. <_<"

      – Deep-B
      Mar 23 '14 at 0:41













      7














      You could also use a StringVar variable, even if it's not strictly necessary:



      v = StringVar()

      e = Entry(master, textvariable=v)
      e.pack()

      v.set("a default value")
      s = v.get()


      For more information, see this page on effbot.org.






      share|improve this answer




















      • 1





        A StringVar isn't necessary, strictly speaking. They are handy, but for this question they are completely superfluous.

        – Bryan Oakley
        May 23 '12 at 23:03
















      7














      You could also use a StringVar variable, even if it's not strictly necessary:



      v = StringVar()

      e = Entry(master, textvariable=v)
      e.pack()

      v.set("a default value")
      s = v.get()


      For more information, see this page on effbot.org.






      share|improve this answer




















      • 1





        A StringVar isn't necessary, strictly speaking. They are handy, but for this question they are completely superfluous.

        – Bryan Oakley
        May 23 '12 at 23:03














      7












      7








      7







      You could also use a StringVar variable, even if it's not strictly necessary:



      v = StringVar()

      e = Entry(master, textvariable=v)
      e.pack()

      v.set("a default value")
      s = v.get()


      For more information, see this page on effbot.org.






      share|improve this answer















      You could also use a StringVar variable, even if it's not strictly necessary:



      v = StringVar()

      e = Entry(master, textvariable=v)
      e.pack()

      v.set("a default value")
      s = v.get()


      For more information, see this page on effbot.org.







      share|improve this answer














      share|improve this answer



      share|improve this answer








      edited Mar 9 '15 at 21:16









      nbro

      6,08010 gold badges54 silver badges104 bronze badges




      6,08010 gold badges54 silver badges104 bronze badges










      answered May 23 '12 at 20:17









      zortaconzortacon

      4874 silver badges13 bronze badges




      4874 silver badges13 bronze badges







      • 1





        A StringVar isn't necessary, strictly speaking. They are handy, but for this question they are completely superfluous.

        – Bryan Oakley
        May 23 '12 at 23:03













      • 1





        A StringVar isn't necessary, strictly speaking. They are handy, but for this question they are completely superfluous.

        – Bryan Oakley
        May 23 '12 at 23:03








      1




      1





      A StringVar isn't necessary, strictly speaking. They are handy, but for this question they are completely superfluous.

      – Bryan Oakley
      May 23 '12 at 23:03






      A StringVar isn't necessary, strictly speaking. They are handy, but for this question they are completely superfluous.

      – Bryan Oakley
      May 23 '12 at 23:03












      3














      A simple example without classes:



      from tkinter import * 
      master = Tk()

      # Create this method before you create the entry
      def return_entry(en):
      """Gets and prints the content of the entry"""
      content = entry.get()
      print(content)

      Label(master, text="Input: ").grid(row=0, sticky=W)

      entry = Entry(master)
      entry.grid(row=0, column=1)

      # Connect the entry with the return button
      entry.bind('<Return>', return_entry)

      mainloop()





      share|improve this answer



























        3














        A simple example without classes:



        from tkinter import * 
        master = Tk()

        # Create this method before you create the entry
        def return_entry(en):
        """Gets and prints the content of the entry"""
        content = entry.get()
        print(content)

        Label(master, text="Input: ").grid(row=0, sticky=W)

        entry = Entry(master)
        entry.grid(row=0, column=1)

        # Connect the entry with the return button
        entry.bind('<Return>', return_entry)

        mainloop()





        share|improve this answer

























          3












          3








          3







          A simple example without classes:



          from tkinter import * 
          master = Tk()

          # Create this method before you create the entry
          def return_entry(en):
          """Gets and prints the content of the entry"""
          content = entry.get()
          print(content)

          Label(master, text="Input: ").grid(row=0, sticky=W)

          entry = Entry(master)
          entry.grid(row=0, column=1)

          # Connect the entry with the return button
          entry.bind('<Return>', return_entry)

          mainloop()





          share|improve this answer













          A simple example without classes:



          from tkinter import * 
          master = Tk()

          # Create this method before you create the entry
          def return_entry(en):
          """Gets and prints the content of the entry"""
          content = entry.get()
          print(content)

          Label(master, text="Input: ").grid(row=0, sticky=W)

          entry = Entry(master)
          entry.grid(row=0, column=1)

          # Connect the entry with the return button
          entry.bind('<Return>', return_entry)

          mainloop()






          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Sep 12 '16 at 15:20









          Marios TheofanidisMarios Theofanidis

          313 bronze badges




          313 bronze badges





















              1














              *



              master = Tk()
              entryb1 = StringVar

              Label(master, text="Input: ").grid(row=0, sticky=W)

              Entry(master, textvariable=entryb1).grid(row=1, column=1)

              b1 = Button(master, text="continue", command=print_content)
              b1.grid(row=2, column=1)

              def print_content():
              global entryb1
              content = entryb1.get()
              print(content)

              master.mainloop()


              What you did wrong was not put it inside a Define function then you hadn't used the .get function with the textvariable you had set.






              share|improve this answer





























                1














                *



                master = Tk()
                entryb1 = StringVar

                Label(master, text="Input: ").grid(row=0, sticky=W)

                Entry(master, textvariable=entryb1).grid(row=1, column=1)

                b1 = Button(master, text="continue", command=print_content)
                b1.grid(row=2, column=1)

                def print_content():
                global entryb1
                content = entryb1.get()
                print(content)

                master.mainloop()


                What you did wrong was not put it inside a Define function then you hadn't used the .get function with the textvariable you had set.






                share|improve this answer



























                  1












                  1








                  1







                  *



                  master = Tk()
                  entryb1 = StringVar

                  Label(master, text="Input: ").grid(row=0, sticky=W)

                  Entry(master, textvariable=entryb1).grid(row=1, column=1)

                  b1 = Button(master, text="continue", command=print_content)
                  b1.grid(row=2, column=1)

                  def print_content():
                  global entryb1
                  content = entryb1.get()
                  print(content)

                  master.mainloop()


                  What you did wrong was not put it inside a Define function then you hadn't used the .get function with the textvariable you had set.






                  share|improve this answer















                  *



                  master = Tk()
                  entryb1 = StringVar

                  Label(master, text="Input: ").grid(row=0, sticky=W)

                  Entry(master, textvariable=entryb1).grid(row=1, column=1)

                  b1 = Button(master, text="continue", command=print_content)
                  b1.grid(row=2, column=1)

                  def print_content():
                  global entryb1
                  content = entryb1.get()
                  print(content)

                  master.mainloop()


                  What you did wrong was not put it inside a Define function then you hadn't used the .get function with the textvariable you had set.







                  share|improve this answer














                  share|improve this answer



                  share|improve this answer








                  edited Mar 23 at 5:06







                  user11093202

















                  answered Mar 2 '16 at 21:15









                  rodude123rodude123

                  801 silver badge15 bronze badges




                  801 silver badge15 bronze badges



























                      draft saved

                      draft discarded
















































                      Thanks for contributing an answer to Stack Overflow!


                      • Please be sure to answer the question. Provide details and share your research!

                      But avoid


                      • Asking for help, clarification, or responding to other answers.

                      • Making statements based on opinion; back them up with references or personal experience.

                      To learn more, see our tips on writing great answers.




                      draft saved


                      draft discarded














                      StackExchange.ready(
                      function ()
                      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f10727131%2fwhy-is-tkinter-entrys-get-function-returning-nothing%23new-answer', 'question_page');

                      );

                      Post as a guest















                      Required, but never shown





















































                      Required, but never shown














                      Required, but never shown












                      Required, but never shown







                      Required, but never shown

































                      Required, but never shown














                      Required, but never shown












                      Required, but never shown







                      Required, but never shown







                      Popular posts from this blog

                      Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

                      SQL error code 1064 with creating Laravel foreign keysForeign key constraints: When to use ON UPDATE and ON DELETEDropping column with foreign key Laravel error: General error: 1025 Error on renameLaravel SQL Can't create tableLaravel Migration foreign key errorLaravel php artisan migrate:refresh giving a syntax errorSQLSTATE[42S01]: Base table or view already exists or Base table or view already exists: 1050 Tableerror in migrating laravel file to xampp serverSyntax error or access violation: 1064:syntax to use near 'unsigned not null, modelName varchar(191) not null, title varchar(191) not nLaravel cannot create new table field in mysqlLaravel 5.7:Last migration creates table but is not registered in the migration table

                      은진 송씨 목차 역사 본관 분파 인물 조선 왕실과의 인척 관계 집성촌 항렬자 인구 같이 보기 각주 둘러보기 메뉴은진 송씨세종실록 149권, 지리지 충청도 공주목 은진현