Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
cpython
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
cpython
Commits
b8fe9b3f
Kaydet (Commit)
b8fe9b3f
authored
Ock 10, 1995
tarafından
Guido van Rossum
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
menu-simple.py: fixed lay-out
bind-with-multiple-calls-per-event-type.py: new, or forgot to add earlier
üst
d0c06336
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
45 additions
and
2 deletions
+45
-2
bind-w-mult-calls-p-type.py
Demo/tkinter/matt/bind-w-mult-calls-p-type.py
+43
-0
menu-simple.py
Demo/tkinter/matt/menu-simple.py
+2
-2
No files found.
Demo/tkinter/matt/bind-w-mult-calls-p-type.py
0 → 100644
Dosyayı görüntüle @
b8fe9b3f
from
Tkinter
import
*
import
string
# This program shows how to use a simple type-in box
class
App
(
Frame
):
def
__init__
(
self
,
master
=
None
):
Frame
.
__init__
(
self
,
master
)
self
.
pack
()
self
.
entrythingy
=
Entry
()
self
.
entrythingy
.
pack
()
# and here we get a callback when the user hits return. we could
# make the key that triggers the callback anything we wanted to.
# other typical options might be <Key-Tab> or <Key> (for anything)
self
.
entrythingy
.
bind
(
'<Key-Return>'
,
self
.
print_contents
)
# Note that here is where we bind a completely different callback to
# the same event. We pass "+" here to indicate that we wish to ADD
# this callback to the list associated with this event type. Not specifying "+" would
# simply override whatever callback was defined on this event.
self
.
entrythingy
.
bind
(
'<Key-Return>'
,
self
.
print_something_else
,
"+"
)
def
print_contents
(
self
,
event
):
print
"hi. contents of entry is now ---->"
,
self
.
entrythingy
.
get
()
def
print_something_else
(
self
,
event
):
print
"hi. Now doing something completely different"
root
=
App
()
root
.
master
.
title
(
"Foo"
)
root
.
mainloop
()
# secret tip for experts: if you pass *any* non-false value as
# the third parameter to bind(), Tkinter.py will accumulate
# callbacks instead of overwriting. I use "+" here because that's
# the Tk notation for getting this sort of behavior. The perfect GUI
# interface would use a less obscure notation.
Demo/tkinter/matt/menu-simple.py
Dosyayı görüntüle @
b8fe9b3f
...
@@ -19,8 +19,8 @@ from Tkinter import *
...
@@ -19,8 +19,8 @@ from Tkinter import *
# | New... |
# | New... |
# | Open... |
# | Open... |
# | Print |
# | Print |
# | | <------
--
This is a MENU. The lines of text in the menu are
# | | <------ This is a MENU. The lines of text in the menu are
# | |
MENU ENTRIES
# | | MENU ENTRIES
# | +---------------+
# | +---------------+
# | Open Files > | file1 |
# | Open Files > | file1 |
# | | file2 |
# | | file2 |
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment