Forum: Python 1 Day Ago |
| Replies: 7 Views: 174 "victory" is a variable that is set to "True" if the user guesses the number or "False" if they do not. At the end of the script, the last two lines check what "victory" is. If it is False (they have... |
Forum: Python 1 Day Ago |
| Replies: 7 Views: 174 Try this:
import random
number=random.randint(1,100)
victory = False
for x in range(0,7):
guess=input("please enter your guess: ")
if guess<number: |
Forum: Python 1 Day Ago |
| Replies: 3 Views: 179 Thanks for the solutions guys. They solved my problem. |
Forum: Python 2 Days Ago |
| Replies: 3 Views: 179 So, I have a script that needs to "clean up" when it is exited: it needs to clear a special logging file and other small things that affect the next startup of the script. The script has a GUI... |
Forum: Python 2 Days Ago |
| Replies: 3 Views: 166 Okay, well I just got it working on Windows also. I have discovered that I can get the process id the same way as in Linux, os.getpid(). I used the following piece of code to actually end the... |
Forum: Python 3 Days Ago |
| Replies: 3 Views: 166 Okay, well after some testing around I got the first one to work flawlessly. I'm only going to be running the Windows version of my script through Cygwin, so I'm not sure if that supports the same... |
Forum: Python 3 Days Ago |
| Replies: 3 Views: 166 Okay, so I'm having a little trouble. Let's say I run "scriptA.py" and it has a GUI (Tkinter) and it is running in its mainloop. I want to create a "scriptB.py" that can end "scriptA.py"; would there... |
Forum: Python 4 Days Ago |
| Replies: 5 Views: 216 Okay, well after about an hour of finding nothing, I worked out a perfect solution. So, it turns out that there is a part of the xlib that Tech B mentioned named "xbindkeys". After installing it, you... |
Forum: Python 5 Days Ago |
| Replies: 5 Views: 216 Okay, thanks for the idea/link. But is there any way at all I could make this compatible with Linux? |
Forum: Python 5 Days Ago |
| Replies: 5 Views: 216 Okay, so I am writing a media player and I would like to be able to control the entire thing without the use of a GUI. So...are there any libraries or anything that would allow me to collect... |
Forum: Java 34 Days Ago |
| Replies: 10 Views: 508 Okay, I would like to start by say I'm sorry if this forum has a strict "no-bump after x days" etiquette, but I found a solution to my problem and I thought I would share. Although I did successfully... |
Forum: Python Oct 23rd, 2009 |
| Replies: 1 Views: 198 Hi, I'm looking for a little help with the function "getattr". Here's my code:
class MyClass:
def __init__(self):
trycmd = getattr(self, "cmd_testing")
try:
... |
Forum: Python Oct 15th, 2009 |
| Replies: 5 Views: 298 That's perfect! Ok, my problem's solved. Thank you very much. |
Forum: Python Oct 14th, 2009 |
| Replies: 5 Views: 298 @Gribouillis: I tried the code you gave me, except I receive an error about an unexpected tag:
Since the source of the HTML page is too long to post, just view the page source via your browser:... |
Forum: Python Oct 14th, 2009 |
| Replies: 12 Views: 575 Sorry, I had a brain fart. My first post said you should change the file to a .pyc (WRONG), you should make it a ".pyw" as jice said.
To do this, just save the file as a .pyw file instead of a .py... |
Forum: Python Oct 14th, 2009 |
| Replies: 12 Views: 575 I don't think Tkinter is your problem, the fact that you are using Python 3.x is the problem. As far as I know, py2exe is not compatible with Python 3.0x. I would probably just convert all my code to... |
Forum: Python Oct 13th, 2009 |
| Replies: 12 Views: 575 You have two options.
1. Save the file as a .pyc instead of a .py.
2. Try "root.withdraw()". (replace root with whatever you named your root widget)
Or you could compile it with py2exe if you... |
Forum: Python Oct 13th, 2009 |
| Replies: 5 Views: 298 So, I have a rather simple question today. I'll try to explain it by using an example. Let's say there is a line of HTML in the page "www.mywebsite.com/py" that says "<tr colData0='Friday'>".... |
Forum: Java Oct 12th, 2009 |
| Replies: 10 Views: 508 Ok, well it's rather hard for me to test as whenever I visit the page with my applet on it, my browser crashes (so all I know is that it doesn't work).
And both my .class file and my .html file... |
Forum: Java Oct 11th, 2009 |
| Replies: 10 Views: 508 1. Yes, Java is enabled.
2. Both of the files have read/write/execute access.
3. Sorry, could you explain this a little bit?
4. No, I received no error messages in Linux or Windows.
If you... |
Forum: Java Oct 10th, 2009 |
| Replies: 10 Views: 508 Thanks for the link, except that example is not even working. I copied and pasted the code verbatim and I still get a little gray box of nothing.
Thanks again.
EDIT: Well, this is odd. I am... |
Forum: Java Oct 10th, 2009 |
| Replies: 10 Views: 508 Ok, well I am JUST beginning to learn Java, and I have run into a little stumbling block. I am attempting to write a little applet, but it doesn't seem to want to run.
My Java code:
import... |
Forum: Python Sep 6th, 2009 |
| Replies: 2 Views: 274 Thanks for the links myle. Except I seem to be having a little trouble with my server (which uses the asyncore module). I'm not quite sure how I can implement ssl into my code:
class... |
Forum: Python Sep 5th, 2009 |
| Replies: 2 Views: 274 Hi, I have written a simple chat server and a client that can connect to it. To make it more secure, I would like to add SSL to the connection process. How would I go about doing this?
Thanks in... |
Forum: Python Aug 19th, 2009 |
| Replies: 5 Views: 424 Ok, well I finally solved this by myself. For the multi-color part, check this (http://www.daniweb.com/forums/thread212452.html) thread. For the part about an auto-scrollbar, I just repeatedly called... |
Forum: Python Aug 19th, 2009 |
| Replies: 1 Views: 234 Sorry, I finally figured this out myself. If anybody is curious:
msgbox = Text(master)
msgbox.tag_config("myfootag", foreground="#66FFFF")
mytext = raw_input("> ")
if "foo" in mytext:
... |
Forum: Python Aug 19th, 2009 |
| Replies: 1 Views: 234 Hi, so in order to make my problem more clear, I shall just make a simple example of what I am trying to do. I will start with a little code:
from Tkinter import *
master = Tk()
msgbox =... |
Forum: Python Aug 13th, 2009 |
| Replies: 5 Views: 424 Sorry for the second post, but I missed sneekula's post.
@sneek: Ok, if I try your code I get the following error:
EDIT: Ok, I figured out that I receive a "TclError" if the contents of the... |
Forum: Python Aug 13th, 2009 |
| Replies: 5 Views: 424 Well, here is my code:
self.scrollbar = Scrollbar(master)
self.scrollbar.pack(side=RIGHT, fill=Y)
self.msgbox = Text(master, bg="black", fg="#0099cc") #33CCCC
self.msgbox.focus_set()... |
Forum: Python Aug 13th, 2009 |
| Replies: 7 Views: 314 Also, if you did not want to use threading/multiprocessing, you could use the "after" method.
Example:
def dothis():
#Do something
master.after(2000,dothis)
master = Tk()... |
Forum: Python Aug 13th, 2009 |
| Replies: 5 Views: 424 Ok, I am writing a client for the "instant messaging" server I just wrote. The client is in all Python, and the GUI is made with Tkinter.
Anyways, my first question is this: is there a way to make... |
Forum: Python Aug 13th, 2009 |
| Replies: 4 Views: 281 Try this:
print "Hello,", name
The why:
If you use the code: "string1"+"string2"
You get the following: string1string2
However, if you use this: "string1","string2"
You get: "string1... |
Forum: Python Aug 13th, 2009 |
| Replies: 11 Views: 436 Well I finally solved the problem, myself. I did this while doing another script. When doing that other script, I got stuck and looked for some samples on the web...somebody on the web used a method... |
Forum: Python Aug 12th, 2009 |
| Replies: 11 Views: 436 I for some reason thought that binding a key to an action was a looping action (like the .mainloop() of a GUI). I'm not sure where I got that notion, but I just combined the two and received no... |
Forum: Python Aug 12th, 2009 |
| Replies: 11 Views: 436 Ok, here's my MyGUI class:
from Tkinter import *
class MyGUI(Frame):
def __init__(self): pass
def setup(self, master, Tkinter, client):
Frame.__init__(self, master)
... |
Forum: Python Aug 11th, 2009 |
| Replies: 11 Views: 436 Ok, sorry but disregard my last post. I think I'm going to just stick with threading. Anyways, I think I am being a little unclear in what my real problem is. It is rather difficult to explain in... |
Forum: Python Aug 10th, 2009 |
| Replies: 11 Views: 436 Thanks for the idea jlm, except I actually think woooee has more of what I am looking for (running two pieces of code continuously and simultaneously).
Except now I get an error without a... |
Forum: Python Aug 10th, 2009 |
| Replies: 11 Views: 436 Ok thanks, that just about did it. Now I just have one slight problem. How would I pass a variable to the "run" method?
For example:
import threading
myapp = MyGUI()
class... |
Forum: Python Aug 10th, 2009 |
| Replies: 11 Views: 436 Ok, I really hated to resort to threading, but it seems like I have no other choice. I am writing a client script for the "instant message" server I just finished writing. Sadly, I am having a... |
Forum: Python Jul 30th, 2009 |
| Replies: 1 Views: 258 Well, sorry for the double post, but I somehow solved my problem. I have no idea how...I just bugged around with some variable names and such and I stopped receiving the error. Weird.
Well, feel... |