SV: Adjust a canvas as the window is resized

2008-03-10 Thread K Viltersten
Do i need to set a callback to a canvas in order to listen to the root window being resized in order to make it adjust its contents? If so, how? If not, how do i make the canvas draw a line from one corner to an other? import Tkinter as tk root = tk.Tk() canvas = tk.Canvas(root)

Changing the size of a Button

2008-03-09 Thread K Viltersten
How do i change the size of a Button (using Tkinter), other than to set it during construction? I've found methods for getting the size but not applying them. I've been laborating with .setvar(*) but i've been unsuccessful. -- Regards Konrad Viltersten sleep

SV: Changing the size of a Button

2008-03-09 Thread K Viltersten
How do i change the size of a Button (using Tkinter), other than to set it during construction? In Tkinter, usually the geometry managers (such as pack) are the ones who size the widgets. If you run something like: import Tkinter as tk root = tk.Tk() def change_size():

SV: SV: Changing the size of a Button

2008-03-09 Thread K Viltersten
What i wish to do is to affect the size of the button but not due to change of text but due to resize of the frame it resides in. This is done by the layout manager, too: import Tkinter as tk root = tk.Tk() button = tk.Button(root, text=42) button.pack(fill=tk.BOTH, expand=True)

SV: Regarding coding style

2008-03-08 Thread K Viltersten
What I really can't stand are the pointy-haired comment blocks at the beginnings of C/C++ functions that do things like tell you the name and return type of the function and list the names and types of the parameters. Gee, thanks. I never could have figured that out from looking at

Adjust a canvas as the window is resized

2008-03-08 Thread K Viltersten
Do i need to set a callback to a canvas in order to listen to the root window being resized in order to make it adjust its contents? If so, how? If not, how do i make the canvas draw a line from one corner to an other? from Tkinter import * class Demo(Frame): def __init__(self, master =

SV: SV: Regarding coding style

2008-03-08 Thread K Viltersten
If you can't/don't look at the source file, then comments aren't going to help (except in the case of something like docstrings in Python). I strongly disagree. Now, perhaps we're talking about different things, here? Usually, in the header file (C++), there won't be any source code,

SV: SV: Quit-command not quiting

2008-03-08 Thread K Viltersten
Gabriel Genellina [EMAIL PROTECTED] skrev i meddelandet news:[EMAIL PROTECTED] En Fri, 07 Mar 2008 13:56:45 -0200, K Viltersten [EMAIL PROTECTED] escribi�: The window itself vanishes if i click the cross in the upper-right corner but pressing the quit-button only makes it pressed

SV: SV: SV: Regarding coding style

2008-03-08 Thread K Viltersten
If you can't/don't look at the source file, then comments aren't going to help (except in the case of something like docstrings in Python). I strongly disagree. Now, perhaps we're talking about different things, here? Usually, in the header file (C++), there won't be any source code,

SV: Regarding coding style

2008-03-08 Thread K Viltersten
/** Projects an object from 3D to 2D using the method of Alexander The Great. \param 3D structure to be projected \returns 2D projection */ public Proj2D get2Dfrom3D(Proj3D param); The above is, to me, very clear and consistent. Not to mention, easily handled with e.g.

Quit-command not quiting

2008-03-07 Thread K Viltersten
I entered the code from tkinter.pdf, section 2 but for reason, the application doesn't close as i press the quit-button. The wondow itself vanishes if i click the cross in the upper-right corner but pressing the quit-button only makes it pressed. Then, the program freezes. This is the code.

SV: Quit-command not quiting

2008-03-07 Thread K Viltersten
The window itself vanishes if i click the cross in the upper-right corner but pressing the quit-button only makes it pressed. Then, the program freezes. How did you run it? From inside IDLE? IDLE itself is written using Tk, and I think that your mainloop interferes with the one inside

Regarding coding style

2008-03-07 Thread K Viltersten
I've been recommended reading of: http://www.python.org/dev/peps/pep-0008/ and in there i saw two things that i need to get elaborated. 1. When writing English, Strunk and White apply. Where can i download it? Am i actually expected to read the whole book? How many people actually do aply it?

SV: Regarding coding style

2008-03-07 Thread K Viltersten
2. You should use two spaces after a sentence-ending period. For heavens sake, why? I've always been obstructed by the double blanks but tolerated them. Now, that i read that it actually is a recommendation, i need to ask about the purpose. (a) It makes the ends of sentences more

SV: Regarding coding style

2008-03-07 Thread K Viltersten
Personally, I dislike double spaces after sentences, but it is not wrong to put them there any more than it is wrong not to put them there. You're lucky my high school typing teacher didn't hear you say that... I'm unclear if your teacher was a double or single spacer. It's only

Location and size of a frame

2008-03-07 Thread K Viltersten
I'm disliking the size of my frame and also i'm disappointed regarding it's location. So, i wish to change them. At this link http://infohost.nmt.edu/tcc/help/pubs/tkinter/frame.html the frame object is discussed but as far i can tell, there are only suggestions regarding what to put in the

SV: Polymorphism using constructors

2008-03-04 Thread K Viltersten
Carl Banks [EMAIL PROTECTED] skrev i meddelandet news:[EMAIL PROTECTED] On Mar 3, 4:17 pm, Raymond Hettinger [EMAIL PROTECTED] wrote: Since Python doesn't support having two methods with the same name, the usual solution is to provide alternative constructors using classmethod():

SV: Polymorphism using constructors

2008-03-04 Thread K Viltersten
Diez B. Roggisch [EMAIL PROTECTED] skrev i meddelandet news:[EMAIL PROTECTED] K Viltersten schrieb: I'm writing a class for rational numbers and besides the most obvious constructor def __init__ (self, nomin, denom): i also wish to have two supporting ones def __init__ (self, integ

SV: SV: Polymorphism using constructors

2008-03-04 Thread K Viltersten
What does SV in the subject mean? Probably, it's an abbreviation of svar, which means reply. -- Regards Konrad Viltersten sleep- a substitute for coffee for the poor ambition - lack of sense to be lazy --

Polymorphism using constructors

2008-03-03 Thread K Viltersten
I'm writing a class for rational numbers and besides the most obvious constructor def __init__ (self, nomin, denom): i also wish to have two supporting ones def __init__ (self, integ): self.__init__ (integ, 1) def __init__ (self): self.__init__ (0, 1) but for some reason (not

Keeping the console window

2008-03-02 Thread K Viltersten
I've proudly connected Notepad++ to edit and run my fantastic software. When that started to work, i noticed that all the printing disappears as the console window vanishes upon the program completion. How can i trick Python program to keep on running even if the actual statements have been

SV: Where's GUI for Python?

2008-03-02 Thread K Viltersten
You should also take a look at wxGlade: http://wxglade.sourceforge.net/ which sits on top of wxPython: http://wxpython.org/ which wraps wxWidgets: http://www.wxwindows.org/ I have used wxGlade, and while it worked well enough, it didn't seem to fit my brain. I

SV: Keeping the console window

2008-03-02 Thread K Viltersten
You may use python in interactive mode: $ python -i yourScript.py Or use a blocking readline: $ cat yourScript.py import sys sys.stdin.readline() Thanks guys! -- Regards Konrad Viltersten sleep- a substitute for coffee for the poor ambition -

SV: SV: Running test01.py under Windows (basic level)

2008-03-01 Thread K Viltersten
snip There will be poking around with %PATH%, i can tell. Never liked to do that under Windows. No need to do that... Create an alias.txt file containing: python=c:\path\to\your\python.exe $* Execute (once, logged as administrator): reg add HKLM\SOFTWARE\Microsoft\Command Processor /v

SV: SV: Running test01.py under Windows (basic level)

2008-03-01 Thread K Viltersten
def bloppA (): print a very advanced piece of code go to File - Open, open your saved file, and use the Run menu (or press F5). When i try that i get this. == RESTART === And nothing more. Do i use wrong print?! You *defined* a function, but aren't *executing* it.

Surprised by the command del

2008-03-01 Thread K Viltersten
I'm reading the docs and at 5.2 the del statement is discussed. At first, i thought i've found a typo but as i tried that myself, it turns it actually does work so. a = [alpha, beta, gamma] del a[2:2] a Now, i expected the result to be that the beta element has been removed. Obviously,

SV: Surprised by the command del

2008-03-01 Thread K Viltersten
I'm reading the docs and at 5.2 the del statement is discussed. At first, i thought i've found a typo but as i tried that myself, it turns it actually does work so. a = [alpha, beta, gamma] del a[2:2] a Now, i expected the result to be that the beta element has been removed.

Where's GUI for Python?

2008-03-01 Thread K Viltersten
I'm certain there is an API for creating GUI's but as far i can find it in the http://docs.python.org/tut/tut.html the only gui is in Guido. What do i miss? -- Regards Konrad Viltersten sleep- a substitute for coffee for the poor ambition - lack of sense to

SV: Surprised by the command del

2008-03-01 Thread K Viltersten
I'm reading the docs and at 5.2 the del statement is discussed. At first, i thought i've found a typo but as i tried that myself, it turns it actually does work so. a = [alpha, beta, gamma] del a[2:2] a Now, i expected the result to be that the beta element has been removed. Obviously,

SV: Where's GUI for Python?

2008-03-01 Thread K Viltersten
import tkininter When that fails, try without the stutter G import tkinter I must be doing something wrong because neither tkinter nor tkininter works. I tried both with and without stuttering. I even asked my wife to stutter some but, sadly, to no avail. When Tim Chase mentioned

SV: Where's GUI for Python?

2008-03-01 Thread K Viltersten
When that fails, try without the stutter G import tkinter I must be doing something wrong because neither tkinter nor tkininter works. I tried both with and without stuttering. I even asked my wife to stutter some but, sadly, to no avail. When Tim Chase mentioned battery-installed,

Running test01.py under Windows (basic level)

2008-02-28 Thread K Viltersten
I have v2.5.2 installed and i've composed a source code i'm sure everybody will be impressed by. It goes like this. def bloppA (): print a very advanced piece of code What i get to work is to make it run from the the snakes shell. Then, i realised that such a masterpiece needs storing in

SV: Running test01.py under Windows (basic level)

2008-02-28 Thread K Viltersten
I have v2.5.2 installed and i've composed a source code i'm sure everybody will be impressed by. It goes like this. def bloppA (): print a very advanced piece of code What i get to work is to make it run from the the snakes shell. Then, i realised that such a masterpiece needs

SV: Running test01.py under Windows (basic level)

2008-02-28 Thread K Viltersten
def bloppA (): print a very advanced piece of code go to File - Open, open your saved file, and use the Run menu (or press F5). When i try that i get this. == RESTART === And nothing more. Do i use wrong print?! -- Regards Konrad Viltersten