Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #24564
| Path | csiph.com!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!feeder2.ecngs.de!ecngs!feeder.ecngs.de!xlned.com!feeder5.xlned.com!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <python@mrabarnett.plus.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; 'below)': 0.07; 'column': 0.07; 'mouse': 0.07; 'responding': 0.07; 'subject:Question': 0.07; 'python': 0.09; 'buttons': 0.09; 'grid': 0.09; 'bind': 0.16; 'from:addr:mrabarnett.plus.com': 0.16; 'from:addr:python': 0.16; 'from:name:mrab': 0.16; 'message-id:@mrabarnett.plus.com': 0.16; 'perhaps:': 0.16; 'row': 0.16; 'subject:Programming': 0.16; 'wrote:': 0.17; 'fairly': 0.21; 'header:In-Reply-To:1': 0.25; 'header:User-Agent:1': 0.26; 'skip:" 20': 0.26; 'efficiently': 0.29; 'received:192.168.1.3': 0.29; 'code': 0.31; 'to:addr:python- list': 0.33; 'skip:b 20': 0.34; 'text': 0.34; 'something': 0.35; 'there': 0.35; 'subject:: ': 0.38; 'to:addr:python.org': 0.39; 'received:192': 0.39; 'received:192.168': 0.40; 'subject:...': 0.63; 'header:Reply-To:1': 0.68; 'reply-to:no real name:2**0': 0.72; 'click': 0.76; 'subject::': 0.83; '(ie': 0.84; 'reply- to:addr:python.org': 0.84; 'subject: ...': 0.84 |
| X-CM-Score | 0.00 |
| X-CNFS-Analysis | v=2.0 cv=KqrPKBqN c=1 sm=1 a=0nF1XD0wxitMEM03M9B4ZQ==:17 a=YsUzL_8ObRgA:10 a=37iT0KVkS4oA:10 a=ihvODaAuJD4A:10 a=OUOv7kDek9cA:10 a=8nJEP1OIZ-IA:10 a=EBOSESyhAAAA:8 a=8AHkEIZyAAAA:8 a=706QETRFC8cu2VsGxGEA:9 a=wPNLvfGTeEIA:10 a=0nF1XD0wxitMEM03M9B4ZQ==:117 |
| X-AUTH | mrabarnett:2500 |
| Date | Thu, 28 Jun 2012 00:43:14 +0100 |
| From | MRAB <python@mrabarnett.plus.com> |
| User-Agent | Mozilla/5.0 (Windows NT 5.1; rv:13.0) Gecko/20120614 Thunderbird/13.0.1 |
| MIME-Version | 1.0 |
| To | python-list@python.org |
| Subject | Re: Question:Programming a game grid ... |
| References | <Np-dnS8nJLnEGnbSnZ2dnUVZ_tCdnZ2d@giganews.com> |
| In-Reply-To | <Np-dnS8nJLnEGnbSnZ2dnUVZ_tCdnZ2d@giganews.com> |
| Content-Type | text/plain; charset=ISO-8859-1; format=flowed |
| Content-Transfer-Encoding | 7bit |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.12 |
| Precedence | list |
| Reply-To | python-list@python.org |
| 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.1575.1340840605.4697.python-list@python.org> (permalink) |
| Lines | 20 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1340840605 news.xs4all.nl 6927 [2001:888:2000:d::a6]:32820 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:24564 |
Show key headers only | View raw
On 27/06/2012 23:21, iconoclast011 wrote:
> Fairly new to Python ... Is there a way to efficiently (different from my brute
> force code shown below) to set up a game grid of buttons (ie with pygame)
> responding to mouse clicks ? I would want to vary the size of the grid ...
>
[code snipped]
Something based around this, perhaps:
buttons = {}
for row in range(10):
for column in range(9):
b = Button(f3, text = "{0}{1}".format(row, column), bg = "white")
b.grid(row=0, column=0)
b.bind('<Button-1>', leftclick) # bind left mouse click
b.bind('<Button-3>', rightclick) # bind left mouse click
buttons['{0}{1}'.format(row, column)] = b
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Question:Programming a game grid ... iconoclast011 <iconoclast011@gmail.com> - 2012-06-27 17:21 -0500
Re: Question:Programming a game grid ... David <dwblas@gmail.com> - 2012-06-27 16:24 -0700
Re: Question:Programming a game grid ... Chris Angelico <rosuav@gmail.com> - 2012-06-28 09:35 +1000
Re: Question:Programming a game grid ... Chris Angelico <rosuav@gmail.com> - 2012-06-28 09:37 +1000
Re: Question:Programming a game grid ... Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-06-28 00:15 +0000
Re: Question:Programming a game grid ... woooee@gmail.com - 2012-06-27 19:15 -0700
Re: Question:Programming a game grid ... alex23 <wuwei23@gmail.com> - 2012-06-27 19:43 -0700
Re: Question:Programming a game grid ... iconoclast011 <iconoclast011@gmail.com> - 2012-06-27 21:59 -0500
Re: Question:Programming a game grid ... Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2012-06-28 02:08 -0400
Re: Question:Programming a game grid ... Temia Eszteri <lamialily@cleverpun.com> - 2012-06-27 20:03 -0700
Re: Question:Programming a game grid ... Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-06-28 04:39 +0000
Re: Question:Programming a game grid ... MRAB <python@mrabarnett.plus.com> - 2012-06-28 00:43 +0100
Re: Question:Programming a game grid ... alex23 <wuwei23@gmail.com> - 2012-06-27 17:31 -0700
Re: Question:Programming a game grid ... Rick Johnson <rantingrickjohnson@gmail.com> - 2012-06-27 21:04 -0700
csiph-web