- Strength to Increase Rep
- +3
- Strength to Decrease Rep
- -0
- Upvotes Received
- 7
- Posts with Upvotes
- 5
- Upvoting Members
- 6
- Downvotes Received
- 3
- Posts with Downvotes
- 2
- Downvoting Members
- 3
I am trying to convert a file to a dictionary here is the contents of the file, Name: DragonMastur; Hand: None; Inventory: {"Gold": 0, "Brush": 0, "Twig": 0, "Sapling": 0, "Metal Axe": 0, "Grass": 0, "Metal Pickaxe": 0, "Metal": 0, "Log": 0, "Diamond": 0, "Stick": 0, "Stone": 0, "Wheat": 0, … | |
It could be simplifide more, I know. I was doing it as an exersise so its rough and skecthy. But it's workable, I tested it more then 50 times. | |
Re: Nice. I like the way you used a loop to make the widgets and place them I never thought of that. | |
Re: use the random module and a for loop like this. import random ll = "a;b;c;d;e;f;g;h;i;j;k;l;m;n;o;p;q;r;s;t;u;v;w;x;y;z" ul = "A;B;C;D;E;F;G;H;I;J;K;L;M;N;O;P;Q;R;S;T;U;V;W;X;Y;Z" key = [] finalKey = [] finalKeyStr = "" lettersList = ll.split(";") + ul.split(";") for number in range(0, 100): key.append(str(random.randint(1, 26))) for letter in range(0, 100): key.append(str(random.choice(lettersList))) for char in key: rl … | |
I would like the widgets on the window to expand as you expand the window. I know you can do it with the pack method but I'm using the grid method to arange my widgets. Pack Method: label = Label(root, text="Some Text") label.pack(expand=1, fill=BOTH) Grid Method I'm using: self.inventoryLabel = … | |
Re: It looks as if only 1/4 of your moudles are missing so looking in your python folder for your moduldes is a way to start. Locations of folders: Mac: /Users/Shared/bin/python Then look for the lib folder. Windows: C:\Python34\Lib Replace "Python34" with what ever version of python your running. If you … | |
Re: My dad gave me a programing idea but I needed ordered dictionaries. I could solve it till now. Thanks! | |
I needed a calculator and I didn't want to use google since my internet is slow. So I made one! Here it is. Working with it is simple. Use the number and operation keys("c" for clear, "p" for pi, and "s" for sqrt) as well as the return and enter … | |
karmstrong ask in the Python chat if any one was farmilar with converting a for loop in C to Python. Here is a program in python that will do it for you! Thank You! | |
I made a little py editor because I didn't want to go to all the troble of installing an idle, but I didn't like notepad either. Here it is! | |
Re: use pygame or tkinter. I recomend Tkinter. It is what I use. | |
Re: I suggest using Tkinter. It is very simple and it is pre installed in python. Here is an example of a window with a single button. from Tkinter import * class App: def helloworldButtonClick(self): print("Hello World!") def __init__(self): self.root = Tk() self.root.geomentry("200x300") self.root.title("Window With Button") self.helloworldButton = Button(self.root, text="Hello World", … | |
Re: what are the error msgs? I tried installing it and needed to set up a PATH for it to word. | |
Re: vegaseat has it right. I used the same kind of menthod in a program for counting the number of words in a file. I just didn't use the ".lower()" part. | |
Re: Use a for loop like this: for x in range(0, 8): if validatemove(move) == True: capture() There are 8 posible times of capture in a single move. This doesn't use variables so there is no risk of it running forever. | |
Re: I have a raspberry pi(Using it right now) and an arduino.Ill see if I can use them together. Iam useing the arduino for a science expiriment and know both python and sketch(I think that is the language that arduino runs on.) Thank vegaseat. | |
I am try to make a program that alows the user to input their username and password to recive a set of options. Right now the options are to look at a file or quit. In order to complete it I need to know how to turn of the visability … | |
Re: You have some errors on the imports, json and RPG_Data. We need the json and RPG_Data files in order to run the program. | |
Re: What your asking sound a lot like what Im making right now. here is what I have so far... Note: If you run the program you will have to make some .txt file and change the directories. import time i = "" fileContents = "" #User 1 password1 = "hellomynameis" … | |
Re: That is very simple math. Try to see if you can come up with something more complex(You should tell the user that they can use a caculator.) Also in line 34 what if the answer is "1221" or somthing random like that? | |
This is a PyEditor I made because I couldn't get a IDLE working on windows 95. | |
Is it posible to have an optional veriable in a funtion? Such as this: >>>def Say(msg, (optional)): >>> print msg >>> print optional >>> >>>Say('hi', 'option') hi option >>>Say('not') not If so How? | |
| |
Re: I have made a py editor which you can open save and run files. It is in python and is .py so you can just run as is. import sys if sys.hexversion >= 0x030000F0: #First find which version and imports to import runningPython3 = True else: runningPython3 = False if … | |
I want to make a game that requires the arrow keys to be pressed. How do I detect if a key has been pressed? | |
Re: I'am using different imports and python 3 import tkinter.filedialog as tk_FileDialog from tkinter import* fileCount = 0 for x in range(0,10) #read as many as you want f = tk_FileDialog.askopenfile(mode='r') #Or what file your trying to open fileContents = f.readlines(1) #Or what lines you want to read if fileContents == … | |
Re: I made a PyEditor so here are a few of the lines from it: import sys if sys.hexversion >= 0x030000F0: #First find which version and imports to import runningPython3 = True else: runningPython3 = False if runningPython3: import tkinter.filedialog as tk_FileDialog from tkinter import* from io import Stringl0 #This is … | |
Re: **Expert** PyEditor1.0 from Tkinter import* import tkDialog as tk_Dialog from Stringl0 import Stringl0 import os recents = [] class PyEditor: def doNew(self): self.text.delete(0.0,END) def doUndo(self): self.text.edit_undo() def doSaveAs(self): file = tk_FileDialog.asksavefile(mode='w') textoutput = self.text.get(0.0,END) file.write(textoutput.rstrip()) file.write('\n') def doOpen(self): file = tk_FileDialog(mode='r') fileContets = file.read() recents.append(file) self.text.delete(0.0,END) self.text.insert(0.0,fileContents) def doRun(self): file … | |
Re: Make sure to import on this one! from msvcrt import getch keypress = 0 stopDown = 0 def keys(TargetKey): while keypress = 0: key = getch() if key == TagetKey: stopDown = 1 keypress = 1 keys(delete) if stopDown == 1: pass #code to stop the download |