226 Posted Topics
Re: Works correctly. Order of operations. This also works: [CODE](-1+0j)**.5[/CODE] without error. | |
Re: Python for .Net is good, but [URL="ironpython.net"]IronPython[/URL] is better. It's Python written in C#, and you can use it with Visual Studio 2010. Check out the main website. Main use of Python? It's easy and powerful. You can embed it in your C# application if you want. You can also … | |
| |
Re: Embedded in your C# windows application? That sounds like IronPython. You can add a reference to IronPython and Microsoft.Scripting.Hosting assemblies to embed a Python application inside your C# one. | |
Re: Why do you have so many global statements? Or did glade do that? You should have self.r, self.a1, etc instead of them all being global. Global is bad. | |
Re: I repro-d your error with this: [CODE]"".replace(0.02,0)[/CODE] What exactly are you trying to do? | |
Re: What you seem to be trying to do is multiply a list by another list. What do you expect the results to be? | |
Re: Either externally in a configuration file or database, or in the registry for Windows. There is no other way. EDIT: or environment variables | |
Re: Well, you won't get an experience like those C# reporters, I think, because there really isn't a Visual Studio for Python. You can take a look at this SO question: [URL="http://stackoverflow.com/questions/177799/what-is-a-good-pdf-report-generator-tool-for-python"]http://stackoverflow.com/questions/177799/what-is-a-good-pdf-report-generator-tool-for-python[/URL] | |
Re: Always use os.path.join! It's much easier and there's less room for error. [icode]workPath = os.path.join('Prod','Projects',project,'shots',path,'render','REN')[/icode] | |
Re: [QUOTE=tonyjv;1261087]I was meaning this Linux command: [url]http://linux.about.com/library/cmd/blcmdl1_file.htm[/url][/QUOTE] I think he also needs a Windows method. If you want to write in a specific encoding, then you can do this: [CODE]import codecs out = open("myfile.txt", "w") out.write(codecs.BOM_UTF8) #makes it obvious what encoding it is out.write(unicode(mytext,"UTF-8")) out.close()[/CODE] If you try to write … | |
Re: [QUOTE=ultimatebuster;1260490]Python is extremely uncommon for use with websites. Sure, it's powerful, easy, but when it comes to real website (assuming that's what you want to do), you need php.[/QUOTE] Very untrue. "Real website"? Is washingtonpost real enough? PHP is great, but Rails and Django are simply much more powerful. ASP.NET … | |
Re: Can we have the entire code? Just "POINT" does really narrow it down much. | |
Re: This is a debugger/disassembler written in Python: [url]http://pedram.redhive.com/PyDbg/docs/[/url] | |
Re: It's always read from the file. Where did you hear otherwise? | |
Re: Very sorry, I don't think any of us have ever used Zope. I think you are better off asking somewhere else. Other threads concerning Zope that are unanswered: [URL="http://www.daniweb.com/forums/thread257316.html"]http://www.daniweb.com/forums/thread257316.html[/URL] [URL="http://www.daniweb.com/forums/thread264047.html"]http://www.daniweb.com/forums/thread264047.html[/URL] | |
![]() | Re: You can do this [CODE]longnumber = long(longnumber) #and it should display the whole thing[/CODE] The << is operation left-shift. |
Re: I'm not understanding the question at all. Do you want to create a list of lists? | |
Re: [QUOTE=echellwig;1257892]Inserting %s didn't seem to do anything except put %s in my outfile. I think the problem is that the program is writing literally what I put in the command. So I need a way for it not to do that, if that's possible.[/QUOTE] That means you did something wrong. … | |
Re: [QUOTE=griswolf;1255778]woops. My bad. This is why we need constructors... I was just typing, not actually trying. I should learn. This code works (but :hasattr isn't a good introduction to classes)[CODE]class SimpleMessageClass: def setMessage(self, message): self.message = message def printMessage(self): if hasattr(self,'message'): print(self.message) else: print("Sorry, I have no message")[/CODE][/QUOTE] Just a … | |
Re: One thing I see is [icode]while done==False[/icode] You should change that to [icode]while not done[/icode] Also, you should have the imports at the beginning, not in the middle of a while loop, since you only import once, usually at the beginning of execution. | |
Re: Well, ethernet cables connect to your network card, so you'll be dealing with your network card mainly. You need to search for modules that allow for [icode]packet capture[/icode] and things like that. | |
Re: [QUOTE=Garrett85;1253989]No. It's not the exactly the same thing as pygame and I'M afraid it wont work with the book I'M trying to learn how to program with. "Head First Programming".[/QUOTE] That means that you will have to either skip learning pygame, or install Python 2.6 (I use it personally, I … | |
Re: You said earlier that Python cannot do case statements. It can somewhat do that, in a different fashion, like this: [CODE]if a==1: pass #do something elif a==2: pass #do some other thing else: pass[/CODE] which is like [CODE=C#]switch(a) { case 1: //do something break; case 2: //do some other thing … | |
Re: Why don't you do, [icode]unsortedT = text1.get(1.0, END).split("\n")[/icode] and then [icode]text1.insert(END, "\n".join(sortedT)[/icode] | |
Interesting right? If you read [URL="http://www.daniweb.com/forums/post1252636.html"]this[/URL] amazing tutorial by lionaneesh, you will understand why I posted this brain-boggling code. | |
![]() | Re: The external module should never need some code from the main module, so as griswolf said, you should probably refactor the code. |
Re: Wouldn't using itertools.permutations be easier? | |
Re: That's what GetWindowText is supposed to do If you want to get the contents, you have to do something like this: [CODE]import win32gui as w WM_GETTEXTLENGTH = 0x0E WM_GETTEXT = 0x0D t1 = w.SendMessage(hwnd, WM_GETTEXTLENGTH, 0, 0) #hwnd has to be the handle to the text control t = " … | |
Re: You can use Jython...[URL="http://www.jython.org/faq2.html"]http://www.jython.org/faq2.html[/URL] | |
Re: Why is google so fast? It uses extremely great data management, for example, it has its own [URL="http://labs.google.com/papers/gfs.html"]GoogleFileSystem[/URL], uses [URL="http://en.wikipedia.org/wiki/Column-oriented_DBMS"]column-oriented dbms[/URL] it has some very ingenious matching algorithms, and not to mention its highly trained batch of [URL="http://www.google.com/technology/pigeonrank.html"]pidgeons[/URL]. | |
Re: tonyjv, I fixed your code so it does work. There are some intricacies of magic methods that are tricky. [CODE]# This class describes the currency in terms of its name and conversion rate. class Currency(object): def __init__(self, name, rate): self.name = name self.rate = rate # This class allows for … | |
Re: To clarify tonyjv's post, let's so for instance to open daniweb in the default browser would be: [icode]os.startfile("http://www.daniweb.com/")[/icode] | |
Re: This is the kind of question you might want to ask on the Python mailing list. The masters are there. | |
Re: Well, in your situation, they are the same: Let's look at this: [CODE]if True: print("A") elif True: print("B")[/CODE] Would display A. Now this: [CODE]if True: print("A") if True: print("B")[/CODE] Would display A B Get it? Of course, in your situation, os.name can't be two things at once, and elif is … | |
Re: sure, here's an example: [CODE]import ctypes user32 = ctypes.windll.user32 while True: inputhex = raw_input("Please enter your desired key's code (HEX): ") keycode = int(inputhex, 16) #VOID keybd_event(BYTE bVk, BYTE bScan, DWORD dwFlags, PTR dwExtraInfo); user32.keybd_event(keycode,0,2,0) #2 is the code for KEYDOWN user32.keybd_event(keycode,0,0,0) #0 is the code for KEYUP [/CODE] Keycodes … | |
Re: Tuples aren't necessarily points logically. When comparing lesser than or greater than with tuples, the first element is compared. | |
Re: Well... I don't think many of us use Python for Symbian, so it's best that you ask on a Symbian forum, but I see that you already have. I don't think the API for turning on and off bluetooth/wifi/and vibration etc. is public. | |
Re: MonoDevelop is for .NET, so I think the Python binding is actually IronPython. You can use either [URL="http://ironpython.net/tools/"]IronPython Tools for Visual Studio[/URL], which supports somewhat good code-completion, a WPF designer, and some better Silverlight support. Of course, you'll need at least Visual Studio 2010, and you can get for free … | |
Re: Not part of the standard library, but you can download them and install them easily. | |
Re: Private attributes are stupid for dynamic languages. Don't you see Python is dynamic and strongly typed, and C++ is dynamic and strongly typed? Python doesn't have them for a reason. It contributes to the beauty of the Python language. So in other words, it is a [I]feature[/I]. Even private attributes … | |
Re: It seems you would use the CallAfter method, as illustrated by sergb. Just remember CallAfter calls its target after the function exits, not immediately. | |
Re: [QUOTE=thejinx0r;1229721]I guess I want it to behave as though it was part of my wallpaper. Because when I click on "show Desktop" it still minimizes the window ( in both examples ).[/QUOTE] That is not possible as cross-platform. | |
Re: Are you sure it's a .NET assembly? Not all dll's work. | |
Re: Well, you need to first write a class. That class should have a method that is something like [I]newOrder()[/I], and also a collection orders. Then work from there. | |
Re: You don't need that many global statements. Actually, the use of global is discouraged. Since catalog variable is constant, just declare it in the beginning of your file. | |
Re: What do you mean? I can't exactly understand what you are trying to do... | |
![]() | Re: Your project is unique and complex in design, and I fully understand the problems you have right now. I don't have any knowledge of PyGame, so I can't really help you with the top-most concept (which is what problems #1-3 are related to) Perhaps, after the window.update() method is called, … ![]() |
Re: tonyjv's solution should be the best for conciseness. |
The End.