RWKV-4-Raven-14B Arena Human Preference 55K
Write me a python script inside a jupyter notebook that allows a user to continually add…
- User
Write me a python script inside a jupyter notebook that allows a user to continually add text from a free text input into a list and then displays the resulting list below the input fields
- Assistant
Sure, here's an example Jupyter notebook code that achieves what you're looking for:
import tkinter as tk from tkinter import ttk import tkinter.simpledialog import re class App: def __init__(self, master): self.master = master master.title("Sample App") self.text_input = tk.StringVar() self.text_input.set("") self.text_input_label = ttk.Label(master, text="Text:") self.text_input_label.grid(row=0, column=0, sticky="w") self.text_input_entry = ttk.Entry(master, width=40, textvariable=self.text_input, justify="right") self.text_input_entry.grid(row=0, column=1, padx=5, pady=5, sticky="w") self.text_input_button = ttk.Button(master, text="Add Text", command=self.add_text) self.text_input_button.grid(row=1, column=0, padx=5, pady=5) self.output_label = ttk.Label(master, text="") self.output_label.grid(row=2, column=0, padx=5, pady=5, sticky="w") self.text_output = tk.StringVar() self.text_output_label.grid(row=3, column=0, padx=5, pady=5) self.text_output_entry = ttk.Entry(master, width=40, textvariable=self.text_output, justify="right") self.text_output_entry.grid(row=3, column=1, padx=5, pady=5) self.result_label = ttk.Label(master, text="") self.result_label.grid(row=4, column=0, padx=5, pady=5) def add_text(self): text = self.text_input.get("1.0", tk.END
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.