why this is showing TypeError: 'builtin_function_or_method' object is not subscriptable [closed]











up vote
0
down vote

favorite












from tkinter import *
from tkinter import messagebox

class after_sign_in(object):
def __init__(self):
self.sign_in_after()
def sign_in_after(self):
self.sign_in=Tk()
self.sign_in.geometry('700x300')
self.sign_in.maxsize(height=300,width=700)
self.sign_in.title('Account')
def sign_out():
messagebox.showinfo('Have A Nice Day','You Are Signed Out')
self.sign_in.destroy()
sign_out=Button(self.sign_in,anchor='ne',text='Sign Out',command=sign_out)
sign_out.pack(side='right')
sign_out.place(x=620,y=5)
fh=open('fh.txt','r+')
_row=0
ct =1
for i in range(len(fh.readlines())):
Label(self.sign_in, text=fh.readlines[i], width=22, anchor='center',padx=5,pady=5 ).grid(row=i,column=1)
Label(self.sign_in, text=str(ct), width=22, anchor='center',padx=5,pady=5 ).grid(row=i+1)

t=after_sign_in()









share|improve this question















closed as off-topic by tharkay, Mark Rotteveel, Tom Toms, GhostCat, stealthyninja Nov 9 at 14:59


This question appears to be off-topic. The users who voted to close gave this specific reason:


  • "Questions seeking debugging help ("why isn't this code working?") must include the desired behavior, a specific problem or error and the shortest code necessary to reproduce it in the question itself. Questions without a clear problem statement are not useful to other readers. See: How to create a Minimal, Complete, and Verifiable example." – tharkay, Mark Rotteveel, Tom Toms, GhostCat, stealthyninja

If this question can be reworded to fit the rules in the help center, please edit the question.









  • 1




    Please fix the formatting, this is absolutely unreadable. And also indicate which line exactly throws the error
    – UnholySheep
    Nov 9 at 12:52















up vote
0
down vote

favorite












from tkinter import *
from tkinter import messagebox

class after_sign_in(object):
def __init__(self):
self.sign_in_after()
def sign_in_after(self):
self.sign_in=Tk()
self.sign_in.geometry('700x300')
self.sign_in.maxsize(height=300,width=700)
self.sign_in.title('Account')
def sign_out():
messagebox.showinfo('Have A Nice Day','You Are Signed Out')
self.sign_in.destroy()
sign_out=Button(self.sign_in,anchor='ne',text='Sign Out',command=sign_out)
sign_out.pack(side='right')
sign_out.place(x=620,y=5)
fh=open('fh.txt','r+')
_row=0
ct =1
for i in range(len(fh.readlines())):
Label(self.sign_in, text=fh.readlines[i], width=22, anchor='center',padx=5,pady=5 ).grid(row=i,column=1)
Label(self.sign_in, text=str(ct), width=22, anchor='center',padx=5,pady=5 ).grid(row=i+1)

t=after_sign_in()









share|improve this question















closed as off-topic by tharkay, Mark Rotteveel, Tom Toms, GhostCat, stealthyninja Nov 9 at 14:59


This question appears to be off-topic. The users who voted to close gave this specific reason:


  • "Questions seeking debugging help ("why isn't this code working?") must include the desired behavior, a specific problem or error and the shortest code necessary to reproduce it in the question itself. Questions without a clear problem statement are not useful to other readers. See: How to create a Minimal, Complete, and Verifiable example." – tharkay, Mark Rotteveel, Tom Toms, GhostCat, stealthyninja

If this question can be reworded to fit the rules in the help center, please edit the question.









  • 1




    Please fix the formatting, this is absolutely unreadable. And also indicate which line exactly throws the error
    – UnholySheep
    Nov 9 at 12:52













up vote
0
down vote

favorite









up vote
0
down vote

favorite











from tkinter import *
from tkinter import messagebox

class after_sign_in(object):
def __init__(self):
self.sign_in_after()
def sign_in_after(self):
self.sign_in=Tk()
self.sign_in.geometry('700x300')
self.sign_in.maxsize(height=300,width=700)
self.sign_in.title('Account')
def sign_out():
messagebox.showinfo('Have A Nice Day','You Are Signed Out')
self.sign_in.destroy()
sign_out=Button(self.sign_in,anchor='ne',text='Sign Out',command=sign_out)
sign_out.pack(side='right')
sign_out.place(x=620,y=5)
fh=open('fh.txt','r+')
_row=0
ct =1
for i in range(len(fh.readlines())):
Label(self.sign_in, text=fh.readlines[i], width=22, anchor='center',padx=5,pady=5 ).grid(row=i,column=1)
Label(self.sign_in, text=str(ct), width=22, anchor='center',padx=5,pady=5 ).grid(row=i+1)

t=after_sign_in()









share|improve this question















from tkinter import *
from tkinter import messagebox

class after_sign_in(object):
def __init__(self):
self.sign_in_after()
def sign_in_after(self):
self.sign_in=Tk()
self.sign_in.geometry('700x300')
self.sign_in.maxsize(height=300,width=700)
self.sign_in.title('Account')
def sign_out():
messagebox.showinfo('Have A Nice Day','You Are Signed Out')
self.sign_in.destroy()
sign_out=Button(self.sign_in,anchor='ne',text='Sign Out',command=sign_out)
sign_out.pack(side='right')
sign_out.place(x=620,y=5)
fh=open('fh.txt','r+')
_row=0
ct =1
for i in range(len(fh.readlines())):
Label(self.sign_in, text=fh.readlines[i], width=22, anchor='center',padx=5,pady=5 ).grid(row=i,column=1)
Label(self.sign_in, text=str(ct), width=22, anchor='center',padx=5,pady=5 ).grid(row=i+1)

t=after_sign_in()






python-3.x






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 9 at 12:53









L3viathan

14.8k12647




14.8k12647










asked Nov 9 at 12:51









Himanshu Mishra

6




6




closed as off-topic by tharkay, Mark Rotteveel, Tom Toms, GhostCat, stealthyninja Nov 9 at 14:59


This question appears to be off-topic. The users who voted to close gave this specific reason:


  • "Questions seeking debugging help ("why isn't this code working?") must include the desired behavior, a specific problem or error and the shortest code necessary to reproduce it in the question itself. Questions without a clear problem statement are not useful to other readers. See: How to create a Minimal, Complete, and Verifiable example." – tharkay, Mark Rotteveel, Tom Toms, GhostCat, stealthyninja

If this question can be reworded to fit the rules in the help center, please edit the question.




closed as off-topic by tharkay, Mark Rotteveel, Tom Toms, GhostCat, stealthyninja Nov 9 at 14:59


This question appears to be off-topic. The users who voted to close gave this specific reason:


  • "Questions seeking debugging help ("why isn't this code working?") must include the desired behavior, a specific problem or error and the shortest code necessary to reproduce it in the question itself. Questions without a clear problem statement are not useful to other readers. See: How to create a Minimal, Complete, and Verifiable example." – tharkay, Mark Rotteveel, Tom Toms, GhostCat, stealthyninja

If this question can be reworded to fit the rules in the help center, please edit the question.








  • 1




    Please fix the formatting, this is absolutely unreadable. And also indicate which line exactly throws the error
    – UnholySheep
    Nov 9 at 12:52














  • 1




    Please fix the formatting, this is absolutely unreadable. And also indicate which line exactly throws the error
    – UnholySheep
    Nov 9 at 12:52








1




1




Please fix the formatting, this is absolutely unreadable. And also indicate which line exactly throws the error
– UnholySheep
Nov 9 at 12:52




Please fix the formatting, this is absolutely unreadable. And also indicate which line exactly throws the error
– UnholySheep
Nov 9 at 12:52












1 Answer
1






active

oldest

votes

















up vote
1
down vote













The problem is here:



text=fh.readlines[i]


fh.readlines is a function that you would need to call first — ideally only once. Iterating over range(len(...)) is almost always useless and can be done easier.



I suggest iterating over the file handle directly (as you don't really need the list of lines. Since you still need the index i, you can use enumerate:



for i, line in enumerate(fh):
Label(self.sign_in, text=line, width=22, anchor='center',padx=5,pady=5 ).grid(row=i,column=1)
Label(self.sign_in, text=str(ct), width=22, anchor='center',padx=5,pady=5 ).grid(row=i+1)





share|improve this answer




























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes








    up vote
    1
    down vote













    The problem is here:



    text=fh.readlines[i]


    fh.readlines is a function that you would need to call first — ideally only once. Iterating over range(len(...)) is almost always useless and can be done easier.



    I suggest iterating over the file handle directly (as you don't really need the list of lines. Since you still need the index i, you can use enumerate:



    for i, line in enumerate(fh):
    Label(self.sign_in, text=line, width=22, anchor='center',padx=5,pady=5 ).grid(row=i,column=1)
    Label(self.sign_in, text=str(ct), width=22, anchor='center',padx=5,pady=5 ).grid(row=i+1)





    share|improve this answer

























      up vote
      1
      down vote













      The problem is here:



      text=fh.readlines[i]


      fh.readlines is a function that you would need to call first — ideally only once. Iterating over range(len(...)) is almost always useless and can be done easier.



      I suggest iterating over the file handle directly (as you don't really need the list of lines. Since you still need the index i, you can use enumerate:



      for i, line in enumerate(fh):
      Label(self.sign_in, text=line, width=22, anchor='center',padx=5,pady=5 ).grid(row=i,column=1)
      Label(self.sign_in, text=str(ct), width=22, anchor='center',padx=5,pady=5 ).grid(row=i+1)





      share|improve this answer























        up vote
        1
        down vote










        up vote
        1
        down vote









        The problem is here:



        text=fh.readlines[i]


        fh.readlines is a function that you would need to call first — ideally only once. Iterating over range(len(...)) is almost always useless and can be done easier.



        I suggest iterating over the file handle directly (as you don't really need the list of lines. Since you still need the index i, you can use enumerate:



        for i, line in enumerate(fh):
        Label(self.sign_in, text=line, width=22, anchor='center',padx=5,pady=5 ).grid(row=i,column=1)
        Label(self.sign_in, text=str(ct), width=22, anchor='center',padx=5,pady=5 ).grid(row=i+1)





        share|improve this answer












        The problem is here:



        text=fh.readlines[i]


        fh.readlines is a function that you would need to call first — ideally only once. Iterating over range(len(...)) is almost always useless and can be done easier.



        I suggest iterating over the file handle directly (as you don't really need the list of lines. Since you still need the index i, you can use enumerate:



        for i, line in enumerate(fh):
        Label(self.sign_in, text=line, width=22, anchor='center',padx=5,pady=5 ).grid(row=i,column=1)
        Label(self.sign_in, text=str(ct), width=22, anchor='center',padx=5,pady=5 ).grid(row=i+1)






        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Nov 9 at 12:55









        L3viathan

        14.8k12647




        14.8k12647















            Popular posts from this blog

            鏡平學校

            ꓛꓣだゔៀៅຸ໢ທຮ໕໒ ,ໂ'໥໓າ໼ឨឲ៵៭ៈゎゔit''䖳𥁄卿' ☨₤₨こゎもょの;ꜹꟚꞖꞵꟅꞛေၦေɯ,ɨɡ𛃵𛁹ޝ޳ޠ޾,ޤޒޯ޾𫝒𫠁သ𛅤チョ'サノބޘދ𛁐ᶿᶇᶀᶋᶠ㨑㽹⻮ꧬ꧹؍۩وَؠ㇕㇃㇪ ㇦㇋㇋ṜẰᵡᴠ 軌ᵕ搜۳ٰޗޮ޷ސޯ𫖾𫅀ल, ꙭ꙰ꚅꙁꚊꞻꝔ꟠Ꝭㄤﺟޱސꧨꧼ꧴ꧯꧽ꧲ꧯ'⽹⽭⾁⿞⼳⽋២៩ញណើꩯꩤ꩸ꩮᶻᶺᶧᶂ𫳲𫪭𬸄𫵰𬖩𬫣𬊉ၲ𛅬㕦䬺𫝌𫝼,,𫟖𫞽ហៅ஫㆔ాఆఅꙒꚞꙍ,Ꙟ꙱エ ,ポテ,フࢰࢯ𫟠𫞶 𫝤𫟠ﺕﹱﻜﻣ𪵕𪭸𪻆𪾩𫔷ġ,ŧآꞪ꟥,ꞔꝻ♚☹⛵𛀌ꬷꭞȄƁƪƬșƦǙǗdžƝǯǧⱦⱰꓕꓢႋ神 ဴ၀க௭எ௫ឫោ ' េㇷㇴㇼ神ㇸㇲㇽㇴㇼㇻㇸ'ㇸㇿㇸㇹㇰㆣꓚꓤ₡₧ ㄨㄟ㄂ㄖㄎ໗ツڒذ₶।ऩछएोञयूटक़कयँृी,冬'𛅢𛅥ㇱㇵㇶ𥄥𦒽𠣧𠊓𧢖𥞘𩔋цѰㄠſtʯʭɿʆʗʍʩɷɛ,əʏダヵㄐㄘR{gỚṖḺờṠṫảḙḭᴮᵏᴘᵀᵷᵕᴜᴏᵾq﮲ﲿﴽﭙ軌ﰬﶚﶧ﫲Ҝжюїкӈㇴffצּ﬘﭅﬈軌'ffistfflſtffतभफɳɰʊɲʎ𛁱𛁖𛁮𛀉 𛂯𛀞నఋŀŲ 𫟲𫠖𫞺ຆຆ ໹້໕໗ๆทԊꧢꧠ꧰ꓱ⿝⼑ŎḬẃẖỐẅ ,ờỰỈỗﮊDžȩꭏꭎꬻ꭮ꬿꭖꭥꭅ㇭神 ⾈ꓵꓑ⺄㄄ㄪㄙㄅㄇstA۵䞽ॶ𫞑𫝄㇉㇇゜軌𩜛𩳠Jﻺ‚Üမ႕ႌႊၐၸဓၞၞၡ៸wyvtᶎᶪᶹစဎ꣡꣰꣢꣤ٗ؋لㇳㇾㇻㇱ㆐㆔,,㆟Ⱶヤマފ޼ޝަݿݞݠݷݐ',ݘ,ݪݙݵ𬝉𬜁𫝨𫞘くせぉて¼óû×ó£…𛅑הㄙくԗԀ5606神45,神796'𪤻𫞧ꓐ㄁ㄘɥɺꓵꓲ3''7034׉ⱦⱠˆ“𫝋ȍ,ꩲ軌꩷ꩶꩧꩫఞ۔فڱێظペサ神ナᴦᵑ47 9238їﻂ䐊䔉㠸﬎ffiﬣ,לּᴷᴦᵛᵽ,ᴨᵤ ᵸᵥᴗᵈꚏꚉꚟ⻆rtǟƴ𬎎

            Why https connections are so slow when debugging (stepping over) in Java?