質問をすることでしか得られない、回答やアドバイスがある。

15分調べてもわからないことは、質問しよう!

新規登録して質問してみよう
ただいま回答率
85.48%
Python 3.x

Python 3はPythonプログラミング言語の最新バージョンであり、2008年12月3日にリリースされました。

Tkinter

Tkinterは、GUIツールキットである“Tk”をPythonから利用できるようにした標準ライブラリである。

UI

UIはUser Interfaceの略であり、人間がコンピュータとやりとりをするためのシステムです。

Python

Pythonは、コードの読みやすさが特徴的なプログラミング言語の1つです。 強い型付け、動的型付けに対応しており、後方互換性がないバージョン2系とバージョン3系が使用されています。 商用製品の開発にも無料で使用でき、OSだけでなく仮想環境にも対応。Unicodeによる文字列操作をサポートしているため、日本語処理も標準で可能です。

Q&A

0回答

934閲覧

TkinterでEntryに入力ができない

noname__

総合スコア3

Python 3.x

Python 3はPythonプログラミング言語の最新バージョンであり、2008年12月3日にリリースされました。

Tkinter

Tkinterは、GUIツールキットである“Tk”をPythonから利用できるようにした標準ライブラリである。

UI

UIはUser Interfaceの略であり、人間がコンピュータとやりとりをするためのシステムです。

Python

Pythonは、コードの読みやすさが特徴的なプログラミング言語の1つです。 強い型付け、動的型付けに対応しており、後方互換性がないバージョン2系とバージョン3系が使用されています。 商用製品の開発にも無料で使用でき、OSだけでなく仮想環境にも対応。Unicodeによる文字列操作をサポートしているため、日本語処理も標準で可能です。

0グッド

0クリップ

投稿2022/01/07 08:08

編集2022/01/07 09:16

Python tkinterでEntryを作ろうとした所,設置はできたが入力ができない
GUIのコードは海外の方が作っていたものをそのまま使いました

Python

1from tkinter import * 2from ctypes import windll 3 4tk_title = "test" 5root=Tk() 6root.title(tk_title) 7root.overrideredirect(True) 8root.geometry('500x300+75+75') 9root.iconbitmap("icon.ico") 10 11root.minimized = False 12root.maximized = False 13 14LGRAY = '#3e4042' 15DGRAY = '#585858' 16RGRAY = '#1d1d1d' 17 18root.config(bg="#585858") 19title_bar = Frame(root, bg=RGRAY, relief='raised', bd=0,highlightthickness=0) 20 21def set_appwindow(mainWindow): 22 GWL_EXSTYLE = -20 23 WS_EX_APPWINDOW = 0x00040000 24 WS_EX_TOOLWINDOW = 0x00000080 25 hwnd = windll.user32.GetParent(mainWindow.winfo_id()) 26 stylew = windll.user32.GetWindowLongW(hwnd, GWL_EXSTYLE) 27 stylew = stylew & ~WS_EX_TOOLWINDOW 28 stylew = stylew | WS_EX_APPWINDOW 29 res = windll.user32.SetWindowLongW(hwnd, GWL_EXSTYLE, stylew) 30 31 mainWindow.wm_withdraw() 32 mainWindow.after(10, lambda: mainWindow.wm_deiconify()) 33 34def minimize_me(): 35 root.attributes("-alpha",0) 36 root.minimized = True 37 38def deminimize(event): 39 root.focus() 40 root.attributes("-alpha",1) 41 if root.minimized == True: 42 root.minimized = False 43 44def maximize_me(): 45 if root.maximized == False: 46 root.normal_size = root.geometry() 47 expand_button.config(text=" ???? ") 48 root.geometry(f"{root.winfo_screenwidth()}x{root.winfo_screenheight()}+0+0") 49 root.maximized = not root.maximized 50 else: 51 expand_button.config(text=" ???? ") 52 root.geometry(root.normal_size) 53 root.maximized = not root.maximized 54close_button = Button(title_bar, text=' × ', command=root.destroy,bg=RGRAY,padx=2,pady=2,font=("calibri", 13),bd=0,fg='white',highlightthickness=0) 55expand_button = Button(title_bar, text=' ???? ', command=maximize_me,bg=RGRAY,padx=2,pady=2,bd=0,fg='white',font=("calibri", 13),highlightthickness=0) 56minimize_button = Button(title_bar, text=' ???? ',command=minimize_me,bg=RGRAY,padx=2,pady=2,bd=0,fg='white',font=("calibri", 13),highlightthickness=0) 57title_bar_title = Label(title_bar, text=tk_title, bg=RGRAY,bd=0,fg='white',font=("helvetica", 10),highlightthickness=0) 58window = Frame(root, bg=DGRAY,highlightthickness=0) 59title_bar.pack(fill=X) 60close_button.pack(side=RIGHT,ipadx=7,ipady=1) 61expand_button.pack(side=RIGHT,ipadx=7,ipady=1) 62minimize_button.pack(side=RIGHT,ipadx=7,ipady=1) 63title_bar_title.pack(side=LEFT, padx=10) 64window.pack(expand=1, fill=BOTH) 65def changex_on_hovering(event): 66 global close_button 67 close_button['bg']='red' 68def returnx_to_normalstate(event): 69 global close_button 70 close_button['bg']=RGRAY 71def change_size_on_hovering(event): 72 global expand_button 73 expand_button['bg']=LGRAY 74def return_size_on_hovering(event): 75 global expand_button 76 expand_button['bg']=RGRAY 77def changem_size_on_hovering(event): 78 global minimize_button 79 minimize_button['bg']=LGRAY 80def returnm_size_on_hovering(event): 81 global minimize_button 82 minimize_button['bg']=RGRAY 83 84def get_pos(event): 85 if root.maximized == False: 86 xwin = root.winfo_x() 87 ywin = root.winfo_y() 88 startx = event.x_root 89 starty = event.y_root 90 ywin = ywin - starty 91 xwin = xwin - startx 92 def move_window(event): 93 root.config(cursor="fleur") 94 root.geometry(f'+{event.x_root + xwin}+{event.y_root + ywin}') 95 def release_window(event): 96 root.config(cursor="arrow") 97 title_bar.bind('<B1-Motion>', move_window) 98 title_bar.bind('<ButtonRelease-1>', release_window) 99 title_bar_title.bind('<B1-Motion>', move_window) 100 title_bar_title.bind('<ButtonRelease-1>', release_window) 101 else: 102 expand_button.config(text=" ???? ") 103 root.maximized = not root.maximized 104 105title_bar.bind('<Button-1>', get_pos) 106title_bar_title.bind('<Button-1>', get_pos) 107close_button.bind('<Enter>',changex_on_hovering) 108close_button.bind('<Leave>',returnx_to_normalstate) 109expand_button.bind('<Enter>', change_size_on_hovering) 110expand_button.bind('<Leave>', return_size_on_hovering) 111minimize_button.bind('<Enter>', changem_size_on_hovering) 112minimize_button.bind('<Leave>', returnm_size_on_hovering) 113resizex_widget = Frame(window,bg=DGRAY,cursor='sb_h_double_arrow') 114resizex_widget.pack(side=RIGHT,ipadx=2,fill=Y) 115 116 117def resizex(event): 118 119 xwin = root.winfo_x() 120 121 difference = (event.x_root - xwin) - root.winfo_width() 122 123 if root.winfo_width() > 150 : 124 try: 125 root.geometry(f"{ root.winfo_width() + difference }x{ root.winfo_height() }") 126 except: 127 pass 128 else: 129 if difference > 0: 130 try: 131 root.geometry(f"{ root.winfo_width() + difference }x{ root.winfo_height() }") 132 except: 133 pass 134 135 136 resizex_widget.config(bg=DGRAY) 137 138resizex_widget.bind("<B1-Motion>",resizex) 139 140resizey_widget = Frame(window,bg=DGRAY,cursor='sb_v_double_arrow') 141resizey_widget.pack(side=BOTTOM,ipadx=2,fill=X) 142 143def resizey(event): 144 145 ywin = root.winfo_y() 146 147 difference = (event.y_root - ywin) - root.winfo_height() 148 149 if root.winfo_height() > 150: 150 try: 151 root.geometry(f"{ root.winfo_width() }x{ root.winfo_height() + difference}") 152 except: 153 pass 154 else: 155 if difference > 0: 156 try: 157 root.geometry(f"{ root.winfo_width() }x{ root.winfo_height() + difference}") 158 except: 159 pass 160 161 resizex_widget.config(bg=DGRAY) 162 163resizey_widget.bind("<B1-Motion>",resizey) 164#-----この部分↓------- 165tkinter.Entry(root).place(x=50,y=80) 166#----------------- 167root.bind("<FocusIn>",deminimize) 168root.after(10, lambda: set_appwindow(root)) 169 170root.mainloop()

気になる質問をクリップする

クリップした質問は、後からいつでもMYページで確認できます。

またクリップした質問に回答があった際、通知やメールを受け取ることができます。

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

guest

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

まだ回答がついていません

会員登録して回答してみよう

アカウントをお持ちの方は

15分調べてもわからないことは
teratailで質問しよう!

ただいまの回答率
85.48%

質問をまとめることで
思考を整理して素早く解決

テンプレート機能で
簡単に質問をまとめる

質問する

関連した質問