password
type
status
date
slug
summary
tags
category
icon
提出需求,然后落地需求。

1.ID拆分工具(简单lua逻辑)

使用lua搓的简单通过”、“拆分ID并输出的工具。
 
具体使用gmatch+insert将ID字符串切割为number,并填入表格。
然后使用ipairs迭代数组。
notion image
很神奇,lua中有自己的for循环写法。
for i , v in ipairs(dataArray) do 独特的for循环语句,用于迭代table。

2.家具ID填入工具(xlwings):

抄作业+快捷填入工具! 首先手动复制作业,然后该工具可以修改选中行的ID(通过读上一个的ID+1),prefab路径(textbox填入),名字(textbox填入后缀+未命名)从而快速搞定家具! 来吧。

步骤一览:

  1. 搓窗口,可视化界面。
  1. 定义组件。
  1. 第一次使用组件变量!—使用组件内容写入数据!
  1. 开始控制!—多页面联动处理!
  1. 其他优化!—解决疑难杂症!

 

step1:

建立简单窗口!:
使用tkinter进行窗口的简单创建。
window = tk.Tk()先声明窗口变量。
window.title(”name”) —修改窗口名。
geometry(”400x300”) —设置大小。
mainloop() —启动!
 

step2:上强度!

通过调用tk的预制组件,为窗口添加可视化交互的组件。
这里稍微封装了一下窗口,使得更加优雅。

python

class SimpleWindow: def __init__(self): self.window = tk.Tk() self.window.title("简单窗口") self.window.geometry("400x300") self.create_widgets() def create_widgets(self): # 添加名字的文本框 self.name_label = tk.Label(self.window, text="名字:") self.name_label.pack() self.name_entry = tk.Entry(self.window) self.name_entry.pack() # 添加Prefab路径的文本框 self.prefab_path_label = tk.Label(self.window, text="Prefab路径:") self.prefab_path_label.pack() self.prefab_path_entry = tk.Entry(self.window) self.prefab_path_entry.pack() # 添加确定按钮 self.submit_button = tk.Button(self.window, text="确定", command=self.on_submit) self.submit_button.pack() def on_submit(self): return def run(self): self.window.mainloop() #实例化SimpleWindow类并运行窗口主循环 simple_window = SimpleWindow() #构造函数 simple_window.run() #启动!
Python
  1. 使用Label作为文本框。Label(对应窗口,text=“对应文字”)
  1. 通过对组件调用pack()打包,使得组件显示在窗口上。
  1. Entry为输入框。通过tk.Entry(窗口)调用+pack生成。
  1. Button(window = 对应窗口,text=“现实字符“, command = 事件)
  1. 最后窗口调用mainloop()启动自己。

step3:第一次使用组件变量!—使用组件内容写入数据!:

python

---Version II--- import tkinter as tk import xlwings as xw class SimpleWindow: def __init__(self): self.window = tk.Tk() self.window.title("天狼星庄园家具填入小工具") self.window.geometry("400x300") self.create_widgets() def create_widgets(self): # 添加名字的文本框 self.name_label = tk.Label(self.window, text="名字:") self.name_label.pack() self.name_entry = tk.Entry(self.window) self.name_entry.pack() # 添加系列的文本框 self.class_label = tk.Label(self.window, text="所属系列:") self.class_label.pack() self.class_entry = tk.Entry(self.window) self.class_entry.pack() # 添加Prefab路径的文本框 self.prefab_path_label = tk.Label(self.window, text="Prefab路径:") self.prefab_path_label.pack() self.prefab_path_entry = tk.Entry(self.window) self.prefab_path_entry.pack() # 添加确定按钮 self.submit_button = tk.Button(self.window, text="确定", command=self.on_submit) self.submit_button.pack() def on_submit(self): # 获取当前选中的Excel行的第一列数据 excel_app = xw.apps.active # 获取当前活动的Excel应用程序 sht = excel_app.books.active.sheets.active # 获取当前活动工作簿和工作表 selected_row = xw.apps.active.selection.row #获取当前选择列. # self.name_entry.delete(0, tk.END) # 清空名字文本框 # self.name_entry.insert("0", cell_value) # 将Excel中的数据填入名字文本框 # 假设您有一个活动工作表的引用,命名为sht name_value = self.name_entry.get() # 获取名字文本框中的数值 #填入数据 sht.range(selected_row,2).value = name_value #打杂 self.name_entry.delete(0, tk.END) # 清空名字文本框 def run(self): self.window.mainloop() # 实例化SimpleWindow类并运行窗口主循环 simple_window = SimpleWindow() simple_window.run()
Python
  1. 先为我们的Button变量绑定一个成员函数(on_submit),编写成员函数使用组件控制excel。
  1. 首先获得当前激活的excel(xw.apps.active),然后获取当前活动的页(因为我们需要在Unit sheet中最先进行操作)。最后获取当前抄作业抄下来的那一行。
  1. 我们此时会在
 

step4:优化完毕!:

 

step5:疑难解答!:

 

step6:周围功能添加:

  1. 批量填入开关:
    1. 当家具
 
工具演示视频:
 
《魔兽斗蛐蛐》—体验总结(新坑)【二游吹水】游戏忠诚度公式
2023-2025 白萧.

白萧の港区 | 一名懂一点程序、TA和绑定的小小策划 美术学习中!

Powered by NotionNext 4.3.1.