How I wrote a youtube graphing visualizer and you can too.
Christofer P. P.
Data analyst(Google) | Data architect (AWS) | Mobile developer ( android )| Technical Support Specialist | Business operations analyst | Consultant | Public Trust
First things first!
I need to let you know that for this project to display the graph we're gonna be using an old gui library called tkinter.
To start we need some imports
from tkinter import *
The first statement says to our interpreter to import all functionality from tkinter library.
import tkinter as tk
The second statement says to import the tkinter object that was declared as "tk" from the tkinter library
window = tk.Tk()
next step is to set a variable named "window" to an object instance of TK by calling the method TK() on a tkinter object instance. In our example that is the tk variable, which again is the instance of a tkinter object.
window.title('CSV to Graph App .... written by: Christofer P. Paes ')
In this line, by calling the title method you can set the top of the windows text by calling the title method or function and passing in some text.
领英推荐
window.geometry("500x500")
Now, this line will provide the size of the window. This is done by using the TK object instance or the variable that the TK object instance is set to and calling the geometry method and passing in a size. Keep in mind that the size parameter format is "width x height", and yes the "x" is required.
window.config(background = "white")
The next line allows for a color scheme for the background color of the window. Call the config method on TK object and set the background parameter to a specific color will result in a specific background color.
label_file_explorer = Label(window,
??????????????text = "Graph display for csv files ",
??????????????width = 100, height = 4,
??????????????fg = "blue")
This little piece of code is an object constructor that is set to a variable named "label_file_explorer" that constructs a Label object. To use the label object you have to pass in an instance of a TK object as the first parameter, the text parameter will set the top of the windows text in a gray label, set the width and height parameters, and the color is controlled by the "fg" parameter
......... to be continued