tkinter for variable nums, x_i, srednee_arifm in python in python

To use tkinter in python and display the values of the variables nums, x_i, and srednee_arifm, you can create a simple graphical user interface (GUI) using the Tk class.

Here is an example code that displays the values of the variables in a label widget:

main.py
import tkinter as tk

# example values for the variables
nums = [1, 2, 3, 4, 5]
x_i = 3
srednee_arifm = sum(nums) / len(nums)

# create the GUI
root = tk.Tk()

# create a label widget to display the values
label = tk.Label(root, text=f"nums={nums}\nx_i={x_i}\nsrednee_arifm={srednee_arifm}")

# pack the label widget to display it
label.pack()

# start the mainloop of the GUI
root.mainloop()
393 chars
19 lines

This code creates a Label widget that displays the values of the variables nums, x_i, and srednee_arifm. The text argument of the Label widget is set to a formatted string that displays the values of the variables.

The pack() method is called on the Label widget to display it in the GUI.

Finally, the mainloop() method is called on the Tk instance to start the GUI and run the event loop.

gistlibby LogSnag