226 Posted Topics

Member Avatar for persianprez

[QUOTE=persianprez;1167551]For my extra credit, I'm supposed to generate the longest chain from 1-1000000, I wan't to know if it is correct..here is my code: the caller [CODE] start = 1 end = 1000000 longest, chain = -1, -1 #choiceX(start) for i in range((end-start)+1): if choiceX(start) > longest: longest=start chain=choiceX(start) start+=1 …

Member Avatar for persianprez
0
96
Member Avatar for Oron123

[QUOTE=Oron123;1165832]hi, i have a big exe program that i wrote in c# (big means that i have a lot of class in it), i want to write a script in python that will check the program. what is the right way to check the program, convert the c# program to …

Member Avatar for jcao219
0
140
Member Avatar for Enders_Game

I think cx_Freeze supports python 3.0 [URL="http://cx-freeze.sourceforge.net/"]http://cx-freeze.sourceforge.net/[/URL]

Member Avatar for jcao219
0
156
Member Avatar for jeffery12109

[QUOTE=jeffery12109;1166015]I know how to make classes. I'm just asking for your suggestion. I think you should use this instead if using classes [CODE]class monster(): def __init__(self, hp, type, attackDmg, defence): self.hp = hp self.type = type self.attackDmg = attackDmg self.defence = defence def attacker(self, unitBeingAttacked): dmgDone = self.attackDmg*unitBeingAttacked.defense birdMon = …

Member Avatar for jcao219
0
140
Member Avatar for revellution

Well, my initial comment is, great work! If this is your first program, then you are doing really great! [B]What is good:[/B] [LIST=1][*]You have a [icode]while True:[/icode]! It might not seem like much, but your use of it indicates that you really understand how loops work. [*]You are using [icode]if …

Member Avatar for revellution
0
125
Member Avatar for Kruptein

make it a raw string "\" escapes! [code] string=r'\xb4\xe0\xa0LH/\xefO\xc9|y7&"Af' len(string) [/code]

Member Avatar for jcao219
0
231
Member Avatar for larrywjr

[QUOTE=larrywjr;1160816]Yes I did run python-2.6.4.msi for Python on Windows. When I installed Python. Python itself works fine. Also, I succeeded in downloading this "Packager", Py2exe, on a separate computer. That computer does not even have Python on it. I apologize but I might be missing something basic in my understanding …

Member Avatar for jcao219
0
245
Member Avatar for Mathhax0r

[CODE]def decorator(function): def wrapped(*args,**keywargs): print("Decorated") return wrapped class MyMetaClass(type): def __new__(meta,classname,bases,classDict): for name,item in classDict.items(): if hasattr(item,"__call__"): classDict[name] = decorator(item) return type.__new__(meta,classname,bases,classDict) class MyClass(object): __metaclass__ = MyMetaClass def __init__(self): print("This is my class.") def method(self): print("This is my method.") x = MyClass() x.method() [/CODE] That's how I would do it. …

Member Avatar for jcao219
0
11K
Member Avatar for sanchow

Can you explain the details of the file you want to split? if each line is like this: "A,B,C 1,2,3", you can do str.split(" ") and you'll get: ["A,B,C","1,2,3"] and do another str.split(",") and you'll have nice organized lists and go from there

Member Avatar for sanchow
0
117
Member Avatar for wtzolt

[QUOTE=Pupo;1142188]Hi. Notepad is on your PATH, inside Windows directory. For other programs to be launched, i guess you should call them with the complete path, like c:/Program\ files/Program/My_program.exe I don't use Windows, so I'm guessing.[/QUOTE] almost, Windows is weird with backslashes (and also case insensitive) "C:\Program Files\Program\my_program.exe"

Member Avatar for vegaseat
0
6K
Member Avatar for pankajpriyam

[QUOTE=pankajpriyam;1141510]Hi, error: [Errno 10061] No connection could be made because the target machine actively refused it[/QUOTE] I recognize that error. I had it before when I was making an internet chat client in IronPython. It happens when the server is behind a firewall or something. It happened to me because …

Member Avatar for jcao219
0
159
Member Avatar for kfancy

try this: [CODE] response = input("Hit or stay: ").lower() if (response != "hit") and (response != "stay"): #bad response pass else: #good response pass [/CODE] the above post might not work since if the user types something other than number, int() won't work, and there will be an exception.

Member Avatar for jcao219
-1
102
Member Avatar for atqamar

That would be Interop. It's certainly possible with Python, you just have to use the right modules. Although in my opinion it would be easiest in a .NET language, like C# or VB.NET, but that might be because I am more fluent in .NET, and I know that .NET provides …

Member Avatar for Stefano Mtangoo
0
158
Member Avatar for anishakaul

Well, with some help from icky microsoft .net that is very possible with IronPython. I'm afraid that's the only way to go.

Member Avatar for anishakaul
0
3K
Member Avatar for PinkStone

Oh you can't do that [I]easily[/I] with normal python! Gotta use interop Learn .NET and IronPython (or any .NET language) and use Microsoft.Office.Interop.Word Since Microsoft is .NET, Word can be accessed from .NET the easiest. That's what I would do. Here's something that could help (its a full code snippet): …

Member Avatar for PinkStone
0
125
Member Avatar for Godflesh

Define the class first before you make a reference to it! although this might not fix your problem [code] import time from threading import Thread from threading import Lock class MyThread(Thread): def __init__(self, i): Thread.__init__(self) self.i = i self.lock = Lock() def run(self): while True: self.lock.acquire() try: fh = file("fault.txt","a") …

Member Avatar for jcao219
0
382
Member Avatar for deonis
Member Avatar for deonis
0
13K
Member Avatar for Namibnat

I'm not sure, but Pidgin, the popular chat client uses Aspell. So maybe try that: [URL="http://aspell.net/"]http://aspell.net/[/URL] You can make your own spell-checker refer to this: [URL="http://norvig.com/spell-correct.html"]http://norvig.com/spell-correct.html[/URL] All you need is a text file with a list of correctly spelled words. That you can find at aspell somewhere.

Member Avatar for Namibnat
0
370
Member Avatar for JackintheMox
Member Avatar for mahimahi42

Game Programming is very difficult. I don't quite like the blender game engine. I prefer to use Panda3D if I am writing a game in python. First learn python, the language, as a whole.

Member Avatar for jcao219
0
147
Member Avatar for pigmalion

Nowadays you should do : [icode]super(DatePlus, self).__init__(y,m,d)[/icode] I think. Instead of explicitly calling __init__ Also change this: [icode](y, m, d) = self.translate_string(self, arg[0])[/icode] to this: [icode](y, m, d) = self.translate_string(arg[0])[/icode] Also, [icode]type('')[/icode] can be replaced with [icode]str[/icode]

Member Avatar for pigmalion
0
87
Member Avatar for lewashby

You can change player to i if you want. Doesn't matter. You can change it to asdfjklkansns if you want to.

Member Avatar for jcao219
0
113
Member Avatar for lewashby

Well, the two RANKS and SUITS part of the Card class are unnecessary I believe. The super allows the Positionable_Card class to refer to its parent, the Card class without naming the Card class explicitly. That way, a Positionable_Card object will have a rank and suit just like a Card …

Member Avatar for woooee
0
100
Member Avatar for hondros

well for py2exe just setup the script for the main py file I'm not 100% sure, because IronPython has a compile to exe function, so I never use py2exe

Member Avatar for vegaseat
0
91
Member Avatar for jcao219

This code is IronPython! Won't work with CPython. IronPython - Hello World [CODE] import clr clr.AddReference('System.Windows.Forms') from System.Windows.Forms import Application, Form, Label form = Form(Text="Hello World Form") label = Label(Text="Hello World!") form.Controls.Add(label) Application.Run(form) [/CODE] Editor's note: This post moved from Python GUI Programming sticky thread. Please follow the rules of …

Member Avatar for jcao219
0
121
Member Avatar for ShadyTyrant

I'm not sure, since I don't know much about wxpython. I always code in .Net Perhaps you should make the event handling all inside of the MainWindow class Hopefully that helps, I am about 30% sure.

Member Avatar for ShadyTyrant
0
115

The End.