Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7181185
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T17:30:15+00:00 2026-05-28T17:30:15+00:00

def CreateGUI(): WinCreate=Toplevel(master) WinCreate.attributes(-toolwindow,1) WinCreate.resizable(0,0) WinCreate.transient(master) WinCreate.grab_set() sideframe=Frame(WinCreate,bd=2,relief=GROOVE) Label(WinCreate,text= logbook ,fg=White,bg=#3b5998,font=(RoyalBavarian,20)).pack(side=TOP,fill=X) Label(sideframe,text=Name: ,fg=Black,font=(Tahoma,12)).grid(row=0,column=0,sticky=E) Label(sideframe,text=Age:

  • 0
def CreateGUI():
    WinCreate=Toplevel(master)
    WinCreate.attributes("-toolwindow",1)
    WinCreate.resizable(0,0)
    WinCreate.transient(master)
    WinCreate.grab_set()
    sideframe=Frame(WinCreate,bd=2,relief=GROOVE)
    Label(WinCreate,text="                        logbook                         ",fg="White",bg="#3b5998",font=("RoyalBavarian",20)).pack(side=TOP,fill=X)
    Label(sideframe,text="Name: ",fg="Black",font=("Tahoma",12)).grid(row=0,column=0,sticky=E)
    Label(sideframe,text="Age: ",fg="Black",font=("Tahoma",12)).grid(row=1,column=0,sticky=E)
    Label(sideframe,text="Gender: ",fg="Black",font=("Tahoma",12)).grid(row=2,column=0,sticky=E)
    Label(sideframe,text="Eye Color: ",fg="Black",font=("Tahoma",12)).grid(row=3,column=0,sticky=E)
    txtName=Entry(sideframe)
    txtAge=Entry(sideframe)
    txtEye=Entry(sideframe)
    txtName.grid(row=0,column=1)
    txtAge.grid(row=1,column=1)
    var=StringVar(sideframe)
    var.set("Male")
    optGender=OptionMenu(sideframe,var,"Male","Female")
    optGender.grid(row=2,column=1)
    txtEye.grid(row=3,column=1)
    sideframe.pack(side=LEFT,pady=7,padx=7,ipady=3,ipadx=3)
    rightside=Frame(WinCreate,height=116,width=283)
    irighttop=Frame(rightside,bd=2,relief=GROOVE)
    irightbottom=Frame(rightside,bd=2,width=274,height=50,relief=GROOVE)
    Label(irighttop,text="Username: ",fg="Black",font=("Tahoma",12)).grid(row=0,column=0,sticky=E)
    Label(irighttop,text="Password: ",fg="Black",font=("Tahoma",12)).grid(row=1,column=0,sticky=E)
    Label(irighttop,text="Confirm Password: ",fg="Black",font=("Tahoma",12)).grid(row=2,column=0,sticky=E)
    txtUsername=Entry(irighttop)
    txtPassword=Entry(irighttop)
    txtConPass=Entry(irighttop)
    txtUsername.grid(row=0,column=1)
    txtPassword.grid(row=1,column=1)
    txtConPass.grid(row=2,column=1)
    irighttop.pack(side=TOP,ipady=3,ipadx=3)
    btnCreateFinal=Button(irightbottom,text="Create",fg="Black",command=Create(txtName,txtAge,txtEye,var,txtPassword,txtConPass,txtUsername))
    btnCancel=Button(irightbottom,text="Cancel",fg="Black")
    btnCreateFinal.pack(side=LEFT)
    btnCancel.pack(side=RIGHT)
    irightbottom.pack_propagate(0)
    irightbottom.pack(side=BOTTOM,ipady=3,ipadx=3)
    rightside.pack_propagate(0)
    rightside.pack(side=RIGHT)
def Create(txtName,txtAge,txtEye,var,txtPassword,txtConPass,txtUsername):
    choice='1'
    password="blank"
    conpassword="blank2"
    #----------------------
    name=txtName.get()
    age=txtAge.get()
    gender=var.get()
    eye=txtEye.get()
    password=txtPassword.get()
    conpassword=txtConPass.get()

My question here is how can I get data from the entry boxes if they are in another function? All the entry boxes are in CreateGUI() function. I thought to pass the variables txtName etc to the Create() function. Is this method correct?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T17:30:16+00:00Added an answer on May 28, 2026 at 5:30 pm

    GUI programming is usually done inside a class:

    class SimpleApp(object):
        def createGUI(self):
            ...
            self.txtName=Entry(sideframe)
            self.txtName.grid(row=0,column=1)
    
        def create(self):
            ...
            name=self.txtName.get()
    

    By making txtName an attribute of self, you can access its value in other methods with self.txtName. The other variables can be handled the same way.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

def initUI(self): self.columnconfigure(5, weight=1) self.rowconfigure(3, weight=1) self.search_label = Label(self, text='Keyword:') self.search_label.grid(row=0, column=0, padx=5) self.keywords
def PortScanWin(): win2 = Toplevel() win2.title(PortScan) win2.wm_maxsize(width='190',height='370') win2.wm_minsize(width='190',height='370') def go(): global app result.delete(1.0,END) app=scan()
def download_if_dne(href, filename): if os.path.isfile(filename): # print 'already downloaded:', href return False else: if
def self.jq_column_models COLUMN_NAME.collect {|x| {:name => x.to_s, :width => 80, :format => 'integer' if
def On_Instrumentation_StartAnimation(): Syntax : On_Instrumentation_StartAnimation() Purpose : Fired if the animation is started Parameters
def myFunc( a, b ): def innerFunc( c ): print c innerFunc( 2 )
def update @album = Album.find(params[:id]) if @album.update_attributes(params[:album]) redirect_to(:action=>'list') else render(:action=>'edit') end end A Rails
def partial(template, *args) options = args.extract_options! options.merge!(:layout => false) if collection = options.delete(:collection) then
def test_method [a, b, c].map {|i| yield(i) } end If I call test_method like
def self.get(server) return unless server server = server.to_s if klass = @handlers[server] obj =

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.