Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from tkinter import Entry
- from tkinter import Listbox
- from tkinter import Menu
- from tkinter import Button
- from tkinter import RAISED
- from tkinter import SUNKEN
- from tkinter import GROOVE
- from tkinter import RIDGE
- from tkinter import Tk
- from tkinter import Label
- import tkinter as tk
- import ctypes
- from tkinter import messagebox
- from tkinter.font import Font
- import sys
- from tkinter import PhotoImage
- from PIL import Image,ImageTk
- from tkinter import FLAT
- from tkinter import Frame
- from tkinter import BOTH
- from tkinter import YES
- from tkinter import Y
- from tkinter import Scrollbar
- from tkinter import RIGHT
- from tkinter import ttk
- ventana = Tk()
- class editlistBox(tk.Listbox):
- def __init__(self,ventana,ancho,alto,posx,posy):
- Listbox.__init__(self,width=ancho,height=alto)
- self.ventana = ventana
- self.config(borderwidth=2,highlightthickness=3,highlightcolor="#00AA00",selectforeground="#ffffff",selectbackground="#0EE700",selectborderwidth=0,activestyle=tk.NONE)
- self.place(x=posx,y=posy)
- class crearFrame(ttk.Frame):
- def __init__(self, ventana):
- super().__init__(ventana)
- self.pack(fill=tk.BOTH, expand=tk.YES)
- self.listBox = editlistBox(self,45,500,215,30)
- self.label1 = ttk.Label(self,text="Modificar label")
- self.label1.place(x=220,y=35)
- self.label1.lift(self.listBox)
- self.label1.bind('<Double-Button-1>', self.modificarLabel)
- borrarFrame = Button(self)
- borrarFrame.config(width=10,height=10,command=borrarFrame,text="Borrar frame")
- borrarFrame.place(x=10,y=100)
- def modificarLabel(self,_):
- x = self.label1.winfo_x()
- y = self.label1.winfo_y()
- w = self.label1.winfo_width()
- h = self.label1.winfo_height()
- self.label1.place_forget()
- entry2 = ttk.Entry(self)
- entry2.place(x=x,y=y,width=w,height=h)
- entry2.lift(self.listBox)
- print("hecho")
- newFrame = crearFrame(ventana)
- def borrarFrame():
- newFrame.destroy()
- ventana.mainloop()
Advertisement
Advertisement
Advertisement
RAW Paste Data
Copied
Advertisement