10. Dynamic variables using Stringvar() In Tkinter (Python)

preview_player
Показать описание
This video is about creating dynamic variables using StringVar() in Tkinter. The video is a part of the series of "Developing GUI using Tkinter - Python".

For the full version of the code, do visit our Github page :

Feel free to comment and ask questions.
Thank you.
Рекомендации по теме
Комментарии
Автор

Brillant short tutorial. Just what I was looking for

martin-xqte
Автор

Wow this is awesome, previously I was updating my labels with a function that used the .get() with an entry and then that same function replaced the entire label with another one updated but this is much much simpler

daniellira
Автор

I love indian tutorials, keep it going bro ❤

KubaGacek-oyuw
Автор

Thanks guruji for sharing the concept so clear like water

jyotimoyyi
Автор

Thank u very much Harsh, this video is really helpful !!

NotCringy
Автор

what if the string variable is inside a class? i'm having trouble with Stringvar as its not showing the variable value in my tkinter GUI.

klassikalbeat
Автор

Can I get information from a sensor into the textvariable ?

mbshaw
Автор

Brother please help me how i am access data one page to another page and both page are contain many classes how i am access value

mr-ajaychauhan
Автор

I followed your tutorial about "StringVar" but it still doesn't work for me.
I would like to store the selection from the “filedialog.askdirectory()” in my “entry1” box.
But that does not work. I also want to increase the height of my “entry6” but that is only possible with a label. I would like to raise it and left align with “Wrap text”.

Can you help me a little with this?

import customtkinter
import tkinter
from tkinter import *
import tkinter as tk
from tkinter import ttk
from tkinter import Tk, filedialog




# root = customtkinter.CTk()
root = Tk()

root.geometry("800x700")
root.title("SPLCF3, Phase Out Programma.")


def open_file():
filepath = filedialog.askdirectory()
file = open(filepath, "r")
entry1.textIO = file
print()


def input_verwerking():
print("\n")
print("The files will be collected in the folder: ", entry1.get())
print("The aircraft that wil be processed is: ", entry3.get())
# print(entry1.sel2.get())
print(sel2.get()) # I want to transfer this information to "entry1"
exit()


label = customtkinter.CTkLabel(root, text="SPL/CF3 A/C Phase Out System!", font=("Arial", 24))
label.pack(pady=30, padx=15)

frame =
frame.pack(pady=10, padx=10, expand=True)

sel2 = StringVar()


def submit():
print("\n")


def submit1():
open_file_path = filedialog.askdirectory() # Returns opened path as str


entry1 = ttk.Entry(master=frame, textvariable=sel2, width=27)

entry2 = tkinter.Label(master=frame, text="Select a the folder where to start :")

entry3 = ttk.Combobox(master=frame, values=["AAA", "BBB", "CCC", "DDD", "EEE", "FFF", "GGG", ], font=("Ariel", 10), width=20)

entry4 = tkinter.Label(master=frame, text="Select an aircraft :")

entry5 = Button(master=frame, text="Browse", command=submit1)

entry6 = tkinter.Label(master=frame, width=100, height=20, textvariable=sel2)

button = customtkinter.CTkButton(master=frame, text="Start Processing", command=input_verwerking,
font=("Ariel", 16))

entry1.grid(row=2, column=2, pady=25, padx=10) # "Phase Out Folder" text in text box
entry2.grid(row=2, column=0, pady=25, padx=10) # "Select a the folder where to start :", label column 1
entry3.grid(row=3, column=2, pady=25, padx=20) # Aircraft selection, column 2
entry4.grid(row=3, column=0, pady=25, padx=10) # "Submit", "Select an aircraft :"
entry5.grid(row=2, column=3, pady=25, padx=10) # "Brows", column 3, row 4
entry6.grid(row=4, column=0, columnspan=16, pady=25, padx=10)

button.grid(row=9, column=2, pady=25, padx=10)

root.mainloop()

Lorenzolorenzo-tg
Автор

to access the stringvar() variable of one class into another class using python.
can you help me.

waseemakramkhan
Автор

Thank you bro, it also works with intVar()?

diegosalvatierra