Hello, I'm learning Python. It is my first interpreted language. I have some experience with C and C++. I must admit that it's very hard for me to accept a concept of interpreted language. For example I write code in C++, compile it, link it and I have .exe file which I can send to my friend who doesn't have any C++ compiler or anything and it works. So I can see with my own eyes (and others as well) product and that is .exe program that can be run on different machines. On the other hand, I wrote simple …

Member Avatar
Member Avatar
+0 forum 11

Hello, I'm using PythonWin and I have a problem. i don't know how to run script from Python shell Pythonwin Interactive Window). For example I wrote this code (from tutorial): [code] import sys print 'Begining... now...' for x in sys.argv: print x [/code] and I save it as Script.py in Folder Atest which is in Python24 However, I have a problem to run it with command line arguments. I can do that by choosing File->Run and then to enter arguments, but I'd like to find out how to to run script from shell. At first, I thought the problem is …

Member Avatar
Member Avatar
+0 forum 13

Hello, I'm writing a simple calculator in C. The main problem is I need to parse string to evaluate for example 1+2*(3-1)/2.5. However writing such parses is a very hard task. This is a trivial thing Python using this code: [code] s = raw_input('Please enter expression:') try: x = eval(s) except NameError: print 'Unknown elements in the expression!' except ZeroDivisionError: print 'Division with zero attempted!' except: print 'Some other kind of error!' else: print 'Expression is evaluated correctly' [/code] I saw that Python has C API so I assume that Python functions can be called from C. Is it possible …

Member Avatar
Member Avatar
+0 forum 10

Hi to all, after two months I decided to give Python one more chance. Here is a little code snippet about counting number of words in text file. (Under word I assume any combination of letters and numbers delimited by standard separators " .,\n\t" [code] file = open ( "Test.txt", "r" ) text = file.read ( ) file.close ( ) word_freq ={ } word_list = string.split ( text ) for word in word_list: count = word_freq.get ( string.lower ( word ), 0 ) word_freq[string. lower ( word )] = count + 1 keys = word_freq.keys ( ) keys.sort ( ) …

Member Avatar
Member Avatar
+0 forum 14

Hello guys, It's been a while since I last time posted in this forum. I have strange problem regarding matrix allocation. I was asked to write code that includes 2D array dynamic allocation. I write two version of matrix allocation. Here is in my opinio relevant part of the code: [code] #include <stdio.h> #include <stdlib.h> int main( void ) { int rows, cols; int i, j; /*int * mat1Blok;*/ int ** mat1; printf("Enter number of rows: "); scanf("%d", &rows); printf("Enter number of columns: "); scanf("%d", &cols); /*memory allocation*/ /* mat1Blok = malloc(rows * cols * sizeof(int)); mat1 = malloc(rows * …

Member Avatar
Member Avatar
+0 forum 4

Hello people of Python community, I'm back with (so far) strong will to learn Python, just like you. I remember once, Narue told me that good way to learn different prog. languages is to concetrate on algorithms and data structures and their implementation in language of choice. That way, she said, one can learn both algorithms and data structrues which are language independent but also at the same time can learn the programming language. I tried to follow her advice and by reading her tutorials, I manage to implement most of sorting algorithms in C. Also, I didn't have tough …

Member Avatar
Member Avatar
+0 forum 7

Hello friends, I just want to say that last week a got a job. Since I'm electrical engineer I got job in nearby Thermal power plant. Now, I don't have spare time anymore as I used to have, and I guess it's time to quit my hobbies. Sometimes I'll be coming to this forum but I'm afraid I won't do anything in Python anymore... I first tried to get a job as a programmer since I have a resonable knowledge of C and C++ but failed. Now I get a real job in control engineering and I'm very pleased. I'll …

Member Avatar
Member Avatar
+0 forum 1

Little, by little my calculator is getting a look I want. However, I find that using Tkinter is not very intuitive, and i cannot find detail documentation. have a look at this [code] # menu-example-2.py #from Tkinter import * #root = Tk() #def hello(): #print "hello!" ## create a toplevel menu #try: #menubar = Menu(root) #except: pass #menubar.add_command(label="Hello!", command=hello) #menubar.add_command(label="Quit!", command=root.quit) ## display the menu #root.config(menu=menubar) #mainloop() from Tkinter import * class CalcApp: def __init__ ( self, parent ): #define menubar try: self.menubar = Menu ( parent ) except: pass #create edit menu self.edit_menu = Menu ( self.menubar, tearoff = …

Member Avatar
Member Avatar
+0 forum 14

Hello, I start learning Python GUI using Tkinter as IDE I'm using wing IDE 2.0.3 trial. I'm using Tkinter mainly because of very good debugger. Belive it or not I get exception in this code: [code] from Tkinter import * root = Tk ( ) my_container = Frame ( root ) [/code] Exception is generated in file Tkinter.py in line: [code] def __getattr__(self, attr): "Delegate attribute access to the interpreter object" return getattr(self.tk, attr) [/code] and Exception message is: [code] AttributeError: __nonzero__ Traceback (innermost last): File "c:\PythonProjects\GUILearning\SimpleGUI2.py", line 1, in ? from Tkinter import * File "c:\PythonProjects\GUILearning\SimpleGUI2.py", line 5, in …

Member Avatar
Member Avatar
+0 forum 2

Hi, folks I'm really having a bad time learning Tkinter. I started this morning and it was gooing pretty wel, but I cam accross this problem. How to make application windows of fixed size i.e. maximize button in the title bar is disabled? And also is there any way to change that caption tk in the title bar? I choose to learn Tkinter since I assumed that it 100 % Python multiplatform bla bla, but it seems now that wxPython is a better choice....? - Micko

Member Avatar
Member Avatar
+0 forum 2

I wonder it it is possiblibe to write function to swap two variables like in C [code] void swap (int* x, int*y) { int temp; temp = *x; *x=*y; *y = temp; } [/code] I already tried with soemthing like this: [code] def swap (x, y): tmp = x x = y y = tmp [/code] but it's not it.... Any thoughts?

Member Avatar
Member Avatar
+0 forum 2

Hello, I've been experimenting with different Python IDEs since I started to learn Python. I must say that WingIDE is the best I tried, but unfortunately it's not free and that 10 minutes use is killing me. So I decide to write my Python programs in DrPython which was recommended by vegaseat. DrPython is very pretty nad very customizable IDE.My question is how to debug with DrPython if I have unexpected program behaviour? Does DrPython support debugging at all? It's seems that it's not have breakpoints. I usually switch to PythonWin to trace bugs, but I wonder if there is …

Member Avatar
Member Avatar
+0 forum 2

Hello, I'm trying to execute this simple code: [code] class Person: population = 0 def __init__(self, name): print 'Creating % s peron' % name self.name = name Person.population += 1 def __del__(self): print 'Destroying %s person' % self.name Person.population -= 1 prvi = Person('Asimi') drugi = Person('Mici') [/code] I'm using Wing IDE trial and here's what is output in debug mode: Creating Asimi peron Creating Mici peron Destroying Mici person Exception exceptions.AttributeError: "'NoneType' object has no attribute 'population'" in <bound method Person.__del__ of <__main__.Person instance at 0x00B29558>> ignored Destroying Asimi person Exception exceptions.AttributeError: "'NoneType' object has no attribute 'population'" in …

Member Avatar
Member Avatar
+0 forum 2

Hello, I've downloaded PythonWin as a better IDE for writing Python code. I came across an interesting issue (as vegaseat pointed out) When I try to write this sentence in my native language "Ja sam

Member Avatar
Member Avatar
+0 forum 5

Hi, I wonder if you can give me any advice how to learn Python. My plan is to read python tutorial in documentation from begining to the end, and then to get some book (learning Python, or Python in a nutshell). How long it will take (in average) to get comfortable with the language? I have a solid knowleadge of C and C++ and I see in Python documentation many reference to C, maybe Python is written in C? I'm really very new to this language and to interpreted language as well, so I don't really know what all thah …

Member Avatar
Member Avatar
+0 forum 3

Hello, I've just started to learn Python. I have two questions: 1. Is there any way to set up default folder for Python files (that Atest from introductionary example)? 2. can you suggest any good Python IDE (existing is OK, but I have a fealing that I'm working in ordinary colored Notepad? Thanks

Member Avatar
Member Avatar
+0 forum 5

Hello, I've just read thread why I should lear python and I must admit that I'm very interestwed to learn oppython myself. i have experience with C and C++ programming language. If I understood corectly Python is an interpreted language. What is advantage of interepreted languages (if there are any)? For example I write C++ code compile it, link it and then I can give or sell complete program (exe file). How to distribute interpreted language? Does that mean that I must share source code or what? I really don't have any experience with any interpreted language so, plase, do …

Member Avatar
Member Avatar
+0 forum 2

The End.