Python Forum
Cant transfer a variable onto another function
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Cant transfer a variable onto another function
#5
You can also use functools partial to pas variables.

import tkinter as tk
from tkinter.ttk import *
from functools import partial
window = tk.Tk()

def Adder():
    AddingWindow = tk.Toplevel(window)
    AddingWindow.geometry("400x400")
    Label(AddingWindow, text="Mail/Username", width="20", font="Calibri 22 bold").pack()
    name = Entry(AddingWindow, width=50)
    name.pack()
    Label(AddingWindow, text="Password", width="20", font="Calibri 22 bold").pack()
    passw = Entry(AddingWindow, width=50)
    passw.pack()
    Add = Button(AddingWindow, text="Add", width="20")
    Add.config (command = partial(Save, passw))
    Add.pack ()

def Save(Password):
   print(Password.get())

window.geometry("500x500")
greeting = tk.Label(text="Password Manager: Developed by KEIKAS", font="Calibri 20 bold")
AddB = tk.Button(text="Add", width="20",height="2",bg="green", command=Adder)
AccessB = tk.Button(text="Access", width="20",height="2",bg="blue")
RemoveB = tk.Button(text="Remove", width="20",height="2",bg="red")

greeting.pack()
AddB.pack()
RemoveB.pack()
AccessB.pack()
window.mainloop()
I welcome all feedback.
The only dumb question, is one that doesn't get asked.
My Github
How to post code using bbtags


Reply


Messages In This Thread
RE: Cant transfer a variable onto another function - by menator01 - Feb-07-2022, 06:43 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Variable for the value element in the index function?? Learner1 8 769 Jan-20-2024, 09:20 PM
Last Post: Learner1
  Variable is not defined error when trying to use my custom function code fnafgamer239 4 682 Nov-23-2023, 02:53 PM
Last Post: rob101
  Printing the variable from defined function jws 7 1,519 Sep-03-2023, 03:22 PM
Last Post: deanhystad
  Function parameter not writing to variable Karp 5 1,065 Aug-07-2023, 05:58 PM
Last Post: Karp
  Transfer function victoriomariani 0 651 Dec-10-2022, 01:39 PM
Last Post: victoriomariani
  Retrieve variable from function labgoggles 2 1,100 Jul-01-2022, 07:23 PM
Last Post: labgoggles
Information Estimating transfer function from frd data ymohammadi 0 1,489 Feb-10-2022, 10:00 AM
Last Post: ymohammadi
  Transfer function tanh(Tes) swagata 2 1,749 Aug-20-2021, 01:14 AM
Last Post: swagata
  Please explain uncommon way of declaring and using variable [function.variable] esphi 4 2,411 Nov-07-2020, 08:59 AM
Last Post: buran
  Spyder Quirk? global variable does not increment when function called in console rrace001 1 2,290 Sep-18-2020, 02:50 PM
Last Post: deanhystad

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020