5 examples of 'tkinter entry get text' in Python

Every line of 'tkinter entry get text' code snippets is scanned for vulnerabilities by our powerful machine learning engine that combs millions of open source libraries, ensuring your Python code is secure.

All examples are scanned by Snyk Code

By copying the Snyk Code Snippets you agree to
this disclaimer
1483def get_text(self):
1484 '''Get the text from the widget. Like C{Gtk.Entry.get_text()}
1485 but with UTF-8 decoding and whitespace stripped.
1486 @returns: string
1487 '''
1488 text = Gtk.Entry.get_text(self)
1489 if not text:
1490 return ''
1491 elif self.allow_whitespace:
1492 return text
1493 else:
1494 return text.strip()
Important

Use secure code every time

Secure your code as it's written. Use Snyk Code to scan source code in minutes – no build needed – and fix issues immediately. Enable Snyk Code

44def set(self, text):
45 self.var.set(text)
46 self.default = text
90def run(self):
91 result = super(EntryDialog, self).run()
92 if result == gtk.RESPONSE_OK:
93 text = self.entry.get_text()
94 else:
95 text = None
96 return text
370def _on_text_changed(self, entry):
371 """Close the entry if the colon/slash is deleted and reset search.
372
373 Args:
374 entry: The Gtk.Entry to check.
375 """
376 self._matching_history = []
377 self._pos = 0
378 text = entry.get_text()
379 if not text or text[0] not in ":/":
380 self.leave()
43def __init__(self, parent, text="Text", *args):
44 ttk.Entry.__init__(self, parent, *args)
45 self.parent = parent
46 self._text = text
47
48 self._variable = tk.StringVar()
49
50 self.configure(textvariable=self._variable)
51 self.bind("<FocusIn>", self.check)
52 self.bind("<FocusOut>", self.check)
53
54 self.check()

Related snippets