我希望let target = document.createElement('div');
let source = document.getElementById(this.parentFormId); // change this!
source.parentNode.insertBefore(target,source);
source.childNodes.forEach(node => {
node.parentNode.removeChild(node);
target.appendChild(node);});
source.parentNode.removeChild(source);
target.id = this.parentFormId;
与tkinter Listbox
一起弹出tuple
如果内容存在多个,则只应插入一个内容。在此网站上搜索但未得到解决该问题的答案。
from tkinter import *
rows = (('python', 'kivy'), ('python', 'tkinter'),("python","wxpython",32),
('PHP', 'bootstrap'),('html', 'ajax'),('html', 'css'), ('python', 'tkinter'))
root = Tk()
l = Listbox(root)
for row in rows:
if row[0] not in rows:
l.insert(END, row[0])
l.pack()
root.mainloop()
答案 0 :(得分:1)
根据 @ fhdrsdg 的评论,您将了解如何实现结果。在set
之后,您将使用loop
获取值要在unique
中插入变量Listbox
。
from tkinter import *
rows = (('python', 'kivy'), ('python', 'tkinter'),("python","wxpython",32),
('PHP', 'bootstrap'),('html', 'ajax'),('html', 'css') )
root = Tk()
l = Listbox(root)
unique = set([row[0] for row in rows])
for x in unique:
l.insert(END, x)
l.pack()
root.mainloop()