On 26/11/11 16:16, Mic wrote:
I will first post the entire program here, (not a lot of code)
> and then ask the question.
<---snipped --->
If you press the button in the first window, a new window open with all
the “seats”.
Say that you press one of the buttons so that it turns red. Then you
Mic wrote:
> text_file.close
It has to be
text_file.close()
to actually do something.
> text_file=open(self.filename,"w")
> text_file.write(self.filename)
> text_file.close()
Pro-tip: this can be simplified to
with open(self.filename, "w") as text_file:
text_file.write(self.filename)
>IDLE sometimes slows things down and can occasionally lock
>up with Tkinter (probably because it is itself written in Tkinter!).
>It's usually better and faster to run Tkinter programs from a separate
>console window.
Okay, as a console window I assume the CMD terminal is OK?
>What you a
>> How are you running the code?
> I am running it inside an IDLE. Does it matter
IDLE sometimes slows things down and can occasionally lock
up with Tkinter (probably because it is itself written in Tkinter!).
It's usually better and faster to run Tkinter programs from a separate
console wi
Alright! By the way, it seems like some people favour the use of
pastebins,
while others don?t, which is the way to go and why?
I've stated my preference, Steven has stated his, so I guess you need to
decide for yourself. However the best bet is not to paste long pieces of
code at all, but s
On 26/11/11 12:52, Mic wrote:
Alright! By the way, it seems like some people favour the use of pastebins,
while others don’t, which is the way to go and why?
I've stated my preference, Steven has stated his, so I guess you need to
decide for yourself. However the best bet is not to paste long
>Not really, but a list can handle any kind of data, even functions,
>objects etc (but they are all types of data too)
>I was just being specific that I meant the list of data used to
>configure your widgets. I should probably just have used its name!
Alright! By the way, it seems like some peop
> > and text in your data list and configure each button directly:
> Is there any difference between a list and a data list?
Not really, but a list can handle any kind of data, even functions,
objects etc (but they are all types of data too)
I was just being specific that I meant the list of data
Mic wrote:
[Alan Gauld]
> >def create_widgets(self):
> >list_chair=[(0, 0, '01'), (0, 1, '02'),
> (0, 3, '03'), (0, 4, '04'),
> (1, 0, '05')]
> >for row, column, name in list_chair:
> >command = partial(button_clicked, button)
> >bu
Alright! What is a fixed argument?
Its onre that is the same every time the function is called.
The lambda construct above is equivalent to the following which may
make it clearer:
def button_clicked(aButton):
# do something with aButton here
# that uses a lot of code and
On 26/11/11 00:07, Steven D'Aprano wrote:
Its usually better to paste long programs into a pastebin web site and
give us a link.
I'd just like to say that some of us disagree with this advice. Some
people (e.g. me) often read their where getting access to a browser is
less convenient.
Its tr
Hello Mic,
Mic wrote:
Its usually better to paste long programs into a pastebin web site and
give us a link.
This saves cluttering up people mail with long messages, and also the
pastebin rendering will usually be easier to read with syntax coloring
etc.
Please keep a attribution line when
Alan Gauld wrote:
On 24/11/11 16:20, Mic wrote:
and then try to put these parts togheter into a large program, I decided
to post my entire program.
Its usually better to paste long programs into a pastebin web site and
give us a link.
This saves cluttering up people mail with long messages,
On 25/11/11 21:14, Mic wrote:
Alright. Sorry if I should know this, but what is a pastebin web site
and how do I paste my program into a pastebin web site?
A web site that you can paste stuff and then provide a link(url) that
others can use to view it.
You can usually specify the code style
On 25/11/11 17:11, Mic wrote:
for making a function that calls another function with a fixed
argument is
command = lambda button=button: button_clicked(button)
Alright! What is a fixed argument?
Its onre that is the same every time the function is called.
The lambda construct above is eq
Its usually better to paste long programs into a pastebin web site and
give us a link.
This saves cluttering up people mail with long messages, and also the
pastebin rendering will usually be easier to read with syntax coloring etc.
Alright. Sorry if I should know this, but what is a pastebin
Mic wrote:
>
>> >from functools import partial
>
>>I use this kind of explicit import for a few names that I use frequently,
>>namely defaultdict, contextmanager, everything from itertools...
>>I think of these as my personal extended set of builtins ;)
>
>>As to the actual partial() function,
>from functools import partial
I use this kind of explicit import for a few names that I use frequently,
namely defaultdict, contextmanager, everything from itertools...
I think of these as my personal extended set of builtins ;)
As to the actual partial() function, you probably don't see
On 24/11/11 16:20, Mic wrote:
and then try to put these parts togheter into a large program, I decided
to post my entire program.
Its usually better to paste long programs into a pastebin web site and
give us a link.
This saves cluttering up people mail with long messages, and also the
paste
Good afternoon!
I have previously asked questions about how I can shorten my code.
I have recieved a lot of good answers, but there is one thing that never
works.
I can never implement the suggestions into my code, and that is my fault. I
have in my
previous questions only asked how to shorte
On Wed, Nov 23, 2011 at 2:47 AM, Mic wrote:
>
[LOTS OF STUFF SNIPPED]
>>> self.chair1.configure(bg="green")
>>> os.remove ("Hamburg_Dortmund20_00")
>
>> And now you delete that file you created without having
>> done anything with it?
>
> The meaning is that when the button is pressed once, it ch
OK, So I'll guess you want a desktop program that eventually sends
commands to an online service?
If so thats a lot easier to do with Tkinter... :-)
Well, it is enough if the program can run on my desktop. However, there are
courses about learning how to make programs like these online, but I
22 matches
Mail list logo