Advertisement
Guest User

Untitled

a guest
Feb 22nd, 2020
98
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. from tkinter import Entry
  2. from tkinter import Listbox
  3. from tkinter import Menu
  4. from tkinter import Button
  5. from tkinter import RAISED
  6. from tkinter import SUNKEN
  7. from tkinter import GROOVE
  8. from tkinter import RIDGE
  9. from tkinter import Tk
  10. from tkinter import Label
  11. import tkinter as tk
  12. import ctypes
  13. from tkinter import messagebox
  14. from tkinter.font import Font
  15. import sys
  16. from tkinter import PhotoImage
  17. from PIL import Image,ImageTk
  18. from tkinter import FLAT
  19. from tkinter import Frame
  20. from tkinter import BOTH
  21. from tkinter import YES
  22. from tkinter import Y
  23. from tkinter import Scrollbar
  24. from tkinter import RIGHT
  25. from tkinter import ttk
  26.  
  27. ventana = Tk()
  28.  
  29. class editlistBox(tk.Listbox):
  30. def __init__(self,ventana,ancho,alto,posx,posy):
  31. Listbox.__init__(self,width=ancho,height=alto)
  32. self.ventana = ventana
  33. self.config(borderwidth=2,highlightthickness=3,highlightcolor="#00AA00",selectforeground="#ffffff",selectbackground="#0EE700",selectborderwidth=0,activestyle=tk.NONE)
  34. self.place(x=posx,y=posy)
  35.  
  36.  
  37.  
  38. class crearFrame(ttk.Frame):
  39. def __init__(self, ventana):
  40. super().__init__(ventana)
  41. self.pack(fill=tk.BOTH, expand=tk.YES)
  42. self.listBox = editlistBox(self,45,500,215,30)
  43.  
  44. self.label1 = ttk.Label(self,text="Modificar label")
  45. self.label1.place(x=220,y=35)
  46. self.label1.lift(self.listBox)
  47. self.label1.bind('<Double-Button-1>', self.modificarLabel)
  48.  
  49. borrarFrame = Button(self)
  50. borrarFrame.config(width=10,height=10,command=borrarFrame,text="Borrar frame")
  51. borrarFrame.place(x=10,y=100)
  52.  
  53.  
  54. def modificarLabel(self,_):
  55. x = self.label1.winfo_x()
  56. y = self.label1.winfo_y()
  57. w = self.label1.winfo_width()
  58. h = self.label1.winfo_height()
  59. self.label1.place_forget()
  60.  
  61. entry2 = ttk.Entry(self)
  62. entry2.place(x=x,y=y,width=w,height=h)
  63. entry2.lift(self.listBox)
  64. print("hecho")
  65.  
  66. newFrame = crearFrame(ventana)
  67.  
  68. def borrarFrame():
  69. newFrame.destroy()
  70.  
  71.  
  72. ventana.mainloop()
Advertisement
Advertisement
Advertisement
RAW Paste Data Copied
Advertisement