Advertisement
Guest User

Untitled

a guest
Jan 24th, 2018
518
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.78 KB | None | 0 0
  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()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement