Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #35759
| Path | csiph.com!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!newsreader4.netcologne.de!news.netcologne.de!xlned.com!feeder7.xlned.com!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <rosuav@gmail.com> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.004 |
| X-Spam-Evidence | '*H*': 0.99; '*S*': 0.00; 'elif': 0.04; 'inserts': 0.07; 'tkinter': 0.07; 'command-line': 0.09; 'def': 0.10; 'dec': 0.15; 'weird': 0.15; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'subject:Entry': 0.16; 'subject:Unicode': 0.16; 'sure.': 0.16; 'syntax,': 0.16; 'wrote:': 0.17; 'widget': 0.17; 'seems': 0.23; 'header:In-Reply-To:1': 0.25; 'am,': 0.27; 'message-id:@mail.gmail.com': 0.27; "i'm": 0.29; 'to:addr:python- list': 0.33; 'entry': 0.33; 'that,': 0.34; 'received:google.com': 0.34; 'received:209.85.220': 0.35; 'received:209.85': 0.35; 'but': 0.36; 'why': 0.37; 'received:209': 0.37; 'subject:: ': 0.38; 'some': 0.38; 'to:addr:python.org': 0.39; 'header:Received:5': 0.40; '30,': 0.62; 'more': 0.63; 'charset:windows-1252': 0.65; 'not:': 0.93 |
| DKIM-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type:content-transfer-encoding; bh=KG6FpRuytz9rhJhOPwK217d39mRhtQZjsXVTbA60uMM=; b=ojG866W3rcCds1ZZZSbmuaioEN3rBDr1qNNCY0IyvFSj3yyAGsrb0J79vLmP1Hsy0Q W+ODosa4NISEkXwcOcAI1Z6g4sbAeMfZLwFJaL5GgfdBsxLSizfo4WjGplhOamu8wZoH zM4LjAYRP3z6yRiu8pzpiQjQa5FlQ/CmfIHOSfO78MeA+KZVhoYfI4CrleAwinGO8bxu tCm9HTXMwDsbmgGKe48InVroylAWPbL/tM7s2ZYG28djBeZ/Ub0dRbLrqIuijkn6jmSj j5UX8s4J80bZi3fB3h+2FbYUXiu1ngyYwYIEs/aXwjV0Ug3ZEKhE9rzHmD/HfwIbaK/5 03Kw== |
| MIME-Version | 1.0 |
| In-Reply-To | <50df2439$0$6948$e4fe514c@news.xs4all.nl> |
| References | <df4d0902-c40a-42de-8a6c-b997460313a9@googlegroups.com> <50df2439$0$6948$e4fe514c@news.xs4all.nl> |
| Date | Sun, 30 Dec 2012 04:23:07 +1100 |
| Subject | Re: Inserting Unicode chars in Entry widget |
| From | Chris Angelico <rosuav@gmail.com> |
| To | python-list@python.org |
| Content-Type | text/plain; charset=windows-1252 |
| Content-Transfer-Encoding | quoted-printable |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.15 |
| Precedence | list |
| List-Id | General discussion list for the Python programming language <python-list.python.org> |
| List-Unsubscribe | <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe> |
| List-Archive | <http://mail.python.org/pipermail/python-list/> |
| List-Post | <mailto:python-list@python.org> |
| List-Help | <mailto:python-list-request@python.org?subject=help> |
| List-Subscribe | <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.1432.1356801796.29569.python-list@python.org> (permalink) |
| Lines | 31 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1356801796 news.xs4all.nl 6893 [2001:888:2000:d::a6]:33524 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:35759 |
Show key headers only | View raw
On Sun, Dec 30, 2012 at 4:11 AM, Irmen de Jong <irmen.NOSPAM@xs4all.nl> wrote:
> b1=Button(f, text='char1', command=lambda b=1: insert_char(b))
> b2=Button(f, text='char2', command=lambda b=2: insert_char(b))
> ...etc..
>
> def insert_char(b):
> if b==1:
> entrywidget.insert(0, u"\u20ac") # inserts € in the entry widget e
> elif b==2:
> entrywidget.insert(0, ...some other char...)
> ...
I'm not familiar with tkinter syntax, but why not:
b1=Button(f, text='char1', command=lambda: insert_char(1))
b2=Button(f, text='char2', command=lambda: insert_char(2))
or even:
b1=Button(f, text='char1', command=lambda: insert_char(u"\u20ac"))
b2=Button(f, text='char2', command=lambda: insert_char("... some other
char..."))
Seems weird to multiplex like that, but if there's a good reason for
it, sure. I'm more of a GTK person than tkinter, and more of a
command-line guy than either of the above.
ChrisA
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Inserting Unicode chars in Entry widget Alan Graham <alan.l.graham@gmail.com> - 2012-12-29 08:43 -0800
Re: Inserting Unicode chars in Entry widget Chris Angelico <rosuav@gmail.com> - 2012-12-30 03:58 +1100
Re: Inserting Unicode chars in Entry widget Irmen de Jong <irmen.NOSPAM@xs4all.nl> - 2012-12-29 18:11 +0100
Re: Inserting Unicode chars in Entry widget Chris Angelico <rosuav@gmail.com> - 2012-12-30 04:23 +1100
Re: Inserting Unicode chars in Entry widget Irmen de Jong <irmen.NOSPAM@xs4all.nl> - 2012-12-29 20:15 +0100
csiph-web