为了减少代码的数量(以及懒惰),我在python中这样做,认为它会让我写得少于[# command_properties.py
import tkinter as tk
from tkinter import messagebox
import pygubu
# define the function callbacks
def on_button1_click():
tk_messageBox -message answer -type ok -icon info
class MyApplication(pygubu.TkApplication):
def _create_ui(self):
#1: Create a builder
self.builder = builder = pygubu.Builder()
#2: Load an ui file
builder.add_from_file('test.ui')
#3: Create the widget using self.master as parent
self.mainwindow = builder.get_object('Frame_1', self.master)
# Configure callbacks
callbacks = {
'on_button1_clicked': on_button1_click
}
builder.connect_callbacks(callbacks)
if __name__ == '__main__':
root = tk.Tk()
app = MyApplication(root)
app.run()
]
[0,0],[0,0]....
但是当我分配a = [[0,0]]*10
之类的内容时,我的所有值都变成[1,2](如a[0][:] = [1,2]
)
我已经检查过,如果我做了整个[[[1,2]]*10
],我可以解决问题,但这并不好。有谁可以帮助我?
答案 0 :(得分:-1)
我用Numpy解决了它。
{{1}}