开发者

Opening different windows in wxPython using strings from a list

I have a list of file locations stored as strings. I want to be able to open a separate window for all of the different strings. What would be the best way to do that? Essentially, You click a button, the strings are constructed and they are left in a list. When I was prototyping, I built a small program to display the contents of one static file. It works, but the location is static.I want to add to the clicked button function a program that would iterate over the list and open each on开发者_如何学Goe of the contents in a new window. Right now the list is constructed and the window opens with the contents, but I am not sure how to combine the two. As always, any help much appreciated.


for s in mystrings:
    open_window_for_string(s)

I'm sure you can supply a definition for open_window_for_string if you know how to open a window with the contents of a file...

Also, it doesn't actually have to be a function of one argument, of course, define it to accept whatever additional arguments are necessary. Or use whatever expression will open the kind of window you'd like to use without wrapping it up in a function.

In fact, just take the code you use to display your static file, replace the filename with a variable -- called filename, perhaps -- then use a for loop to iterate over your list of strings. Simple!

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜