PYTHON
How to save user input to a text file using tkinter label
#save.py, python3
import tkinter as tk
from tkinter import messagebox
def save_msg():
#get label text and write to file data.txt
msg['text'] = msg_inp.get()
print("Get Text from Label 'msg':",msg['text'])
f = open("data.txt","w")
f.write(msg['text'])
f.close()
print("Save Successfull")
msg_inp.delete(0,"end")
messagebox.showinfo("Success", "Successfully Saved
text in label.")
root = tk.Tk()
root.geometry("400x300")
temp = tk.Label(root,text="Enter Message: ")
temp.grid(row = 0,column = 0)
msg_inp = tk.Entry(root,width = 40)
msg_inp.grid(row = 0,column = 1)
enter = tk.Button(root,text="Click",command=save_msg)
enter.grid(row = 1,column = 1)
msg = tk.Label(root,text="Entered Message will display Here.",fg="green")
msg.grid(row = 2,column = 1)
tk.mainloop()



Python
Consider the GUI below (3 Labels and 3 Radiobuttons) which has
been produced with a Python program using the Tkinter
library.
You are required to write a Python program to produce this
interactive GUI.
Your GUI must replicate the example above as closely as
possible, including the same widgets displayed in the sample
positions on the GUI, using the same colours, shapes and relative
sizes. (Note that the GUI border in the sample output does not need
to be...
**Python script** to input from user an URL, fetch the page contents using requests, and save the respective page contents to an appropriately named text file. Wrap this request code in its own function: eg create a function getPageRequests(url).
Using Python’s tkinter Graphical User Interface (GUI) module create a Python program to input the number of each type of coin a user has in their possession and then compute and display the total dollar and cents value of these coins. Your solution must accommodate Dollar, Half-Dollar, Quarter, Dime, Nickel, and Penny coins. Your solution must be robust against invalid inputs (i.e., negative value entered into any coin entry widget).
In python your goal is to ask the user for Nouns, Verbs, Adjectives… and fit them in the text where they appear. Each word should be unique. e.g. ask the user for a Noun and replace the first appearance of [Noun] in the text below by the user input. Technical requirements: Save the following text to a file. Open the file and replace all the words in between [] by user inputs using .format(). (You can manually modify...
In Python, write a program that reads a text file that is provided by the user - ensure that the file exists before processing it! The file might be in a different directory, so be sure to test you logic - the user will provide the absolute path to the file if it is not in the same directory as the Python script! You should then ask the user for what string to search for in the file. Your program...
Write a complete Python program with prompts for the user for the main text file (checks that it exists, and if not, output an error message and stop), for any possible flags (including none), and for any other input that this program may need from the user: split has an option of naming the smaller files head_tail list the first 10 lines (default) and the last 10 lines (default) in order of the given text file flag: -# output #...
write a python program that prompts the user for a name of a text file, opens that file for reading , and tracks the unique words in a file and counts how many times they occur in the file. Your program should output the unique words and how often they occur in alphabetical order. Negative testing for a file that does not exist and an empty file should be implemented.
" In the workshop exercises you have used Python's Tkinter module to create simple Graphical User Interfaces. The following code is an incomplete Python program relying on Tkinter (with deliberately unhelpful variable and function names) which you must complete by filling in the blanks. When complete the program should create a window with two buttons, labelled and!!', respectively. When the button la belled'???' is pushed nothing happens. When the button labelled'!!"is pushed both buttons' labels are set to'!!!' from tkinter...
Topics: list, file input/output (Python) You will write a program that allows the user to read grade data from a text file, view computed statistical values based on the data, and to save the computed statistics to a text file. You will use a list to store the data read in, and for computing the statistics. You must use functions. The data: The user has the option to load a data file. The data consists of integer values representing student...
Python Programming Topics: list, file input/output You will write a program that allows the user to read grade data from a text file, view computed statistical values based on the data, and to save the computed statistics to a text file. You will use a list to store the data read in, and for computing the statistics. You must use functions. The data: The user has the option to load a data file. The data consists of integer values representing...