tkinter python entry height

前端 未结 7 1403
青春惊慌失措
青春惊慌失措 2020-12-06 06:21

I\'m making a simple app just to practice python in which I want to write text as if it were Notepad. However, I can\'t make my entry bigger. I\'m using tkinter for this. Do

相关标签:
7条回答
  • 2020-12-06 06:55

    It sounds like you are looking for tkinter.Text, which allows you to adjust both the height and width of the widget. Below is a simple script to demonstrate:

    from tkinter import Text, Tk
    
    r = Tk()
    r.geometry("400x400")
    
    t = Text(r, height=20, width=40)
    t.pack()
    
    r.mainloop()
    
    0 讨论(0)
  • 2020-12-06 06:57

    Another way would be to increase the internal padding by adding this in the pack method:

    ...
    e = Entry(f,textvariable=1,height=20)
    e.pack(ipady=3)
    ...
    

    for instance. This worked for me for an 'Entry' and it also works with .grid()

    0 讨论(0)
  • 2020-12-06 07:03

    You can change the height of the entry widget. To do so you can write:

    entry_box.place(height=40, width=100)
    

    Change the value according to your needs! IT WORKS !

    0 讨论(0)
  • 2020-12-06 07:05

    Actually it's very easy. You don't need to set height in Entry(), but in place(). for example:

    from tkinter import Entry, Tk
    
    window = Tk()
    t = Entry(window)
    t.place(width=150,height=50)
    
    window.mainloop()
    
    0 讨论(0)
  • 2020-12-06 07:06
    from tkinter import *
    
    root=Tk()
    
    url = Label(root,text="Enter Url")
    url.grid(row=0,padx=10,pady=10)
    
    entry_url = Entry(root,width="50")
    entry_url.grid(row=0,column=1,padx=5,pady=10,ipady=3)
    
    root.geometry("600x300+150+150")
    
    root.mainloop()
    

    learn more follow this github

    output image this is output of above code

    0 讨论(0)
  • 2020-12-06 07:08

    You can also change it by changing the font size :

    Entry(
    root,
    font=("default", 40 or 20 whatever )
    
    )
    
    0 讨论(0)
提交回复
热议问题