Thanks, although you actually missed a step somewhere - the bit where
the user selects how many chairs... But ignoring that...
Where do we select how many destinations you want?
If we stick to 3 for now:
Actually, the user never selects how many destinations that he wants. It is
in the code y
at
is clicked, two if the button labeled destination2 is clicked and so on.
A is the number of the seat that is clicked. This is already working fine
though!
I really hope I made my intentions clearer now. Tell me if it is still
unclear or confusing
vmod(index, 4)
button.grid(row=row, column=column)
root=Tk()
root.title("Booking Window")
app=Destination1_Chairs(root)
root.mainloop()
root=Tk()
root.title("Choose your destinati
Note: I'm struggling to follow your code whilst reading on my phone so the
following suggestions make no reference to your particular codebase
Okay I understand. Perhaps it doesn't matter.
Let's first assume that all buttons could be pressed in any order,
therefore given the following press
ou living if you are waiting for lunch? It's past dinner
here,
so that's why I got mails in the middle of the night! I thought most people
were
from UK!
Mic
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor
Hey again.
I figured I would first post this piece of code and then ask my questions.
FREE = "green"
OCCUPIED = "red"
class Mainwindow(Frame):
def __init__(self,master):
super(Mainwindow,self).__init__(master)
self.grid()
self.create_mainwidgets()
def create_mai
Mic wrote:
I want a function to run every second , how do I do that?
Say that the function look like this:
def hi():
print("hi")
For a script that uses tkinter there's the after() method.
Example:
root = Tk()
def hi():
>print("ho")
-Ursprungligt meddelande-
From: Dave Angel
Sent: Tuesday, November 29, 2011 4:33 PM
To: bod...@googlemail.com
Cc: Mic ; Tutor - python List
Subject: Re: [Tutor] Making a function run every second.
(You put your response in the wrong place; it belongs after the part
you're qu
-Ursprungligt meddelande-
From: Dave Angel
Sent: Tuesday, November 29, 2011 4:25 PM
To: Mic
Cc: tutor@python.org
Subject: Re: [Tutor] How to handle try and except in this case
(You top-posted again. Try to put your remarks AFTER the part you're
quoting, so that the messa
-Ursprungligt meddelande-
From: bod...@googlemail.com
Sent: Tuesday, November 29, 2011 4:19 PM
To: Mic ; tutor-bounces+bodsda=googlemail@python.org ; Tutor - python
List
Subject: Re: [Tutor] Making a function run every second.
You won't get it exactly on because the ti
t syntax, and the only time you can have more than one of
them in one statement, is the chained assignments, where they all get bound
to the same object. You wouldn't want to do this anyway, since it would
leave all those open files in an unspecified state.
Thanks for th
Hey again.
I figured I would first post this piece of code and then ask my questions.
FREE = "green"
OCCUPIED = "red"
class Mainwindow(Frame):
def __init__(self,master):
super(Mainwindow,self).__init__(master)
self.grid()
self.create_mainwidgets()
def create_mai
Hi
I want a function to run every second , how do I do that?
Say that the function look like this:
def hi():
print("hi")
Thanks!
Mic
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription opt
On 2011-11-27 17:58, Mic wrote:
Say that I want to try and open 10 files. If none of these exists, I want
an
error
message to appear. But only if NONE of these files exists.
I know how to handle this with one file. But I don't know how to do that
with more than one.
So the program s
Mic wrote:
class SeatButton(tk.Button):
def __init__(self, master, index):
text = str(index+1)
super(SeatButton, self).__init__(master,
text=text, bg=FREE,
command=self.clicked
k
object while I used more. Hmm, otherwise I can see that you have bound the
button in the main window to the function
def uppdatera(self):
SeatWindow(root)
which opens the SeatWindow right? I probably missed things, but I noticed
that this is much smoother than my alternative!
Thanks !
Mic
>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 I can do this in your piece of code? Is it
possible to do without any trouble?
While this piece of code is very good, I feel that I have it easier to
understand your code.
Perhaps it was I who misunderstood you, sorry if that is the case, but
otherwise this is what I want the
code to do!
came to the conlcusion that if I should add the textfiles we
discussed
earlier on, would I somehow put them in the list, list_chair?
Assuming you feel that it is time for do this, how do I implement the creation
of
these text files into the code that we discussed earlier?
Thanks for your
e button
features.
UI means user interface, right?
You should only ever have one Tk() object in a Tkinter program.
Why is that?
Because thats how Tkinter expects to work! It builds a tree of all the
windows and widgets in your program. If you have two trees in the same
program it can g
very confusing with events winding up in the wrong windows
event queue etc.
Alright, my teacher never mentioned that when he examined my program.
Thanks for your input! Your help is as always appreciated and my apologize
for making confusing posts!
Mic
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor
k.
Why is it not recommended to to mix the styles if you put the respective
imports at the
beginning of the module?
Thanks again for your help and insightful suggestions.
It is really appreciated :)
Mic
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor
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
I chose to ignore the "using classes" part. If you like you can turn the
button_clicked() function into a method of a subclass of Button. You can
also move the Button configuration done in create_widgets() into the
__init__() method of that subclass.
import tkinter as tk
from functools import pa
now.
It would be a lot of functions then, one for each button. How do I
accomplish
the same thing as my code does now, but using one function for all buttons
instead of one function for each button? Is it possible?
I hope these questions aren't stupid.
Thank you for your time!
Mic
uggestions
for a couple of hours and hopefully get it to work. If I fail at that,
perhaps we could
"break it down into more manageable chunks".
Thanks for your help once again!
Mic
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor
Button1 is supposed to represent chair one in the train.
So call it chair_1 or put it in a list called chairs
so that you can access them as chairs[0] or whatever.
But get a name that reflects what its actually used for.
Yes, perhaps that is a good way to go. I didn't think about that.
at
file with the chair's number, price and so on. I have managed to
create this file without
any problem. But the thing is that I have written a function for each of the
chairs that does nearly the same
thing. That is not good, because I want one function to do this for all
chairs.
I know you
Message: 4
Date: Sat, 19 Nov 2011 23:18:01 +
From: Alan Gauld
To: tutor@python.org
Subject: Re: [Tutor] Can I shorten this code?
Message-ID:
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Most peoples code could be shortened. And most of it would be the worse
for it. There ar
Hi!
I am new to programming and it have recently come to my attention that alot
of my code could be shortened.
I have managed to shorten some of the code, but I ran into a problem with
this piece of code:
#Testing changing color and text on two buttons in a GUI.
from tkinter import*
value1=
From: Wayne Werner
Sent: Thursday, November 17, 2011 8:30 PM
To: Mic
Cc: tutor@python.org
Subject: Re: [Tutor] Clock in tkinter?
Say that I have a class and I want to make 100 objects.
Then it could look like this:
class Chairs(object):
#Create the objects
chair1
If you're going to put a function inside your class (since you're using self in
there, I'm sure that's what you meant to do), you should change it to:
def change_value_the_time(self):
and call it with
self.display_time.after(20, self.change_value_the_time)
But your program also has un
From: Wayne Werner
Sent: Wednesday, November 16, 2011 8:38 PM
To: Mic
Cc: tutor@python.org
Subject: Re: [Tutor] Clock in tkinter?
On Wed, Nov 16, 2011 at 11:44 AM, Mic wrote:
I wonder if you have any suggestions regarding how to place widgets in my
window.
Even though I try to
also place the function call there?
self.update_time() as you refered to?
Oh, by top-posting you mean that I include everything I have written before in
my post, and that it is no good to do?
So I just post what I wrote, and nothing from earlier on in
I write
an if statement that says that the computer should print “Hi”
if clock>1:
print (“hi”)
Did I understand that correctly?
Thanks for your answers!
Mic
From: Wayne Werner
Sent: Wednesday, November 16, 2011 5:17 PM
To: Mic
Cc: tutor@python.org
Subject: Re: [Tutor] Clock in tkin
Thank you
Yes, wise statement.
Mic
From: Asokan Pichai
Sent: Wednesday, November 16, 2011 5:17 AM
To: Mic
Cc: tutor@python.org
Subject: Re: [Tutor] Clock in tkinter?
> On Wed, Nov 16, 2011 at 1:30 AM, Mic wrote:
> Hi!
> I am new to programming
WELCOME!
>and I hop this qu
I thought that I could just write an if statement. Like:
if the_time>15:00:00:
print (“Hi, how are you?”)
But it is obviously not working.
Thank you for your help! Another question, am I supposed to add
tutor@python.orgtu...@python.org; as copy? You did that, right?
Regards Mic
From:
Hi!
I am new to programming and I hop this question isn’t stupid.
I am making a small GUI program. It is supposed to have a button and a clock in
it that displays the same time as it is according to the computer.
So as far as I am concerned both the clock and the are supposed to be widgets?
So
38 matches
Mail list logo