Can this be reversed (Tkinter)?
Dave Brueck
dave at pythonapocrypha.com
Fri Jan 2 15:57:31 EST 2004
> I am looking at the format used by root.geometry(). The string returned
> from root.geometry() is "%dx%d+%d+%d". Is there a quick and painless
> way to extract the values from that string (i.e., "100x150+25+25" =>
> (100,150,25,25))?
How about:
s = '100x150+25+25'
import re
reg = re.compile('(\d+)x(\d+)\+(\d+)\+(\d+)')
[int(x) for x in reg.match(s).groups()]
-Dave
More information about the Python-list
mailing list