baqu2213 commited on
Commit
6974b12
1 Parent(s): 6dca748

Update Danbooru Prompt Selector/prompt selector.py

Browse files
Danbooru Prompt Selector/prompt selector.py CHANGED
@@ -106,7 +106,8 @@ def random_function():
106
 
107
  def copy_to_clipboard():
108
  window.clipboard_clear()
109
- window.clipboard_append(text_output.get("1.0", tk.END))
 
110
 
111
  def exit_program():
112
  window.destroy()
@@ -130,6 +131,13 @@ def exit_program():
130
  save_settings()
131
  window.destroy()
132
 
 
 
 
 
 
 
 
133
  window = tk.Tk()
134
  window.title("Prompt Selector for Danbooru tags")
135
  last_deep_search_keywords = None
@@ -189,6 +197,17 @@ button_exit.grid(row=7, column=2, padx=5, pady=5, sticky='w')
189
  text_output = tk.Text(window, height=10, width=70)
190
  text_output.grid(row=9, column=0, columnspan=3, padx=5, pady=5)
191
 
 
 
 
 
 
 
 
 
 
 
 
192
  load_settings()
193
 
194
  window.mainloop()
 
106
 
107
  def copy_to_clipboard():
108
  window.clipboard_clear()
109
+ combined_text = entry_fixed_prompt.get() + "\n" + text_output.get("1.0", tk.END)
110
+ window.clipboard_append(combined_text)
111
 
112
  def exit_program():
113
  window.destroy()
 
131
  save_settings()
132
  window.destroy()
133
 
134
+ def on_ctrl_enter(event):
135
+ random_function()
136
+
137
+ def on_shift_enter(event):
138
+ random_function()
139
+ copy_to_clipboard()
140
+
141
  window = tk.Tk()
142
  window.title("Prompt Selector for Danbooru tags")
143
  last_deep_search_keywords = None
 
197
  text_output = tk.Text(window, height=10, width=70)
198
  text_output.grid(row=9, column=0, columnspan=3, padx=5, pady=5)
199
 
200
+ fixed_prompt_label = tk.Label(window, text="고정 프롬프트: 복사 버튼을 눌렀을 때 동작합니다.")
201
+ fixed_prompt_label.grid(row=10, column=0, columnspan=2, sticky='w')
202
+ entry_fixed_prompt = tk.Entry(window, width=70)
203
+ entry_fixed_prompt.grid(row=11, column=0, columnspan=2, padx=5, pady=5)
204
+
205
+ shortcut_info_label = tk.Label(window, text="* Ctrl+Enter를 누르면 [랜덤] 버튼이 동작합니다.\n* Shift+Enter를 누르면 [랜덤] 버튼이 동작하고, 그 결과가 클립보드에 복사됩니다.", justify=tk.LEFT)
206
+ shortcut_info_label.grid(row=13, column=0, columnspan=3, padx=5, pady=5, sticky='w')
207
+
208
+ window.bind('<Control-Return>', on_ctrl_enter)
209
+ window.bind('<Shift-Return>', on_shift_enter)
210
+
211
  load_settings()
212
 
213
  window.mainloop()