SHARE
TWEET

Untitled

a guest Jan 24th, 2018 148 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #!/usr/bin/env python
  2. # -*- coding: utf-8 -*-
  3.  
  4. from tkinter import ttk
  5. import tkinter as tk
  6.  
  7. class Application(ttk.Frame):
  8.    
  9.     def __init__(self, main_window):
  10.         super().__init__(main_window)
  11.         main_window.title("Combobox")
  12.        
  13.         self.combo_text = tk.StringVar()
  14.         self.combo_text.trace("w", self.text_changed)
  15.        
  16.         self.combo = ttk.Combobox(self, textvariable=self.combo_text)
  17.         self.combo.place(x=50, y=50)
  18.        
  19.         main_window.configure(width=300, height=200)
  20.         self.place(width=300, height=200)
  21.    
  22.     def text_changed(self, *args):
  23.         "Esta funciĆ³n es invocada cada vez que el texto cambia."
  24.         print("Text changed.")
  25.  
  26. main_window = tk.Tk()
  27. app = Application(main_window)
  28. app.mainloop()
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top