This forum is in archive mode. You will not be able to post new content.

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - Ragehottie

Pages: [1] 2 3 ... 16
1
Hacking and Security / Re: Dynamic DNS services?
« on: May 11, 2014, 09:48:14 PM »
My brother turned me to zone edit and thats the only thing I've used since. You can even register your domain with them so its super handy. dd-wrt also supports it if I remember correctly.

zoneedit.com

2
Operating System / Re: (Link) A Guide to Writing Your Own Complete OS
« on: April 22, 2014, 05:08:25 PM »
Cool thanks, not sure if I want to actually do it but I've been wanting a nice read on OS programming

+1 thank ya

3
Projects and Discussion / Re: Download a file via bittorrent in python
« on: March 26, 2014, 06:02:34 PM »
https://github.com/abhijeeth/AutonomoTorrent have fun. It's pure python, has most of it's functionality sectioned off into their own modules, and is open source. If this isn't what you want, you'll have to actually explain what it is you want so that we can be of use to you
\

That's exactly what I wanted before turning to libtorrent. I think I saw that project earlier I guess I didn't check it out. Thank you

4
Projects and Discussion / Re: Download a file via bittorrent in python
« on: March 26, 2014, 05:21:34 PM »
It has source code you can look at to figure out how it works, and also is able to support plug-ins, so it is/could be a starting point to doing it yourself. Figure out how they do it and make it into something of your own. No better resource than an already open platform for you to learn from.

Since I thought there was going to be further discussion I didn't reply but :P

They use a python wrapper they write themselves, and I would rather use the one made by libtorrent. It might be similiar, but I would prefer to learn it via the docs of the one I want than looking at something similiar's source. I guess that's the best way since no one has said differently

5
Projects and Discussion / Re: Download a file via bittorrent in python
« on: March 24, 2014, 11:08:45 PM »
Yea I've seen Deluge it wasn't reeeeeeaaaally what I was wanting  :P
Specifically the python wrapper they use for libtorrent

6
Projects and Discussion / Download a file via bittorrent in python
« on: March 24, 2014, 07:55:14 PM »
I've been moseying around a project idea and to make it happen I want to download some files via bittorrent. And since python is my loc I want to do it in python. I have been thinking and looking around for the best way to do this, and have found a couple ideas. Been looking at libtorrent and the python wrapper for it, but I think I might just use the C library instead(If I go that route). I've looked on github for torrent clients in python and haven't found a good one. So I've got my ideas, but I still can't find one I like, maybe you guys could help me out? I need it to be extremely customizable, not just like pass an external program a link and it downloads it for me.

So, what do you guys think about torrenting in python? Whats the easiest/best way?

7
First person to post about this  8) [8]

8
Scripting Languages / Re: [Python] Hangman
« on: February 23, 2014, 06:25:22 PM »
Thanks guys I successfully re-wrote tried to re-write it using dictionaries today, it cut it down to like 150 lines lol. But the buttons when clicked doesn't call the function with the right arguments.. only uses the last button added to the dictionary's argument.

9
Scripting Languages / [Python] Hangman
« on: February 23, 2014, 02:50:03 AM »
I've been playing hangman on irc a lot, but ever since I'm not able anymore I decided to write my own little hangman game. Uses tkinter for the gui. Code is probably pretty inefficient but it works for the most part lol.


Put the attached words.txt in the same directory as the script.


See what happens when batman = True ;)


Code: (python) [Select]
import random
import linecache
from Tkinter import *
from functools import partial

word = ''
guessed_word = ''
guessed_letters = ''
total_letters = 0
num_guessed_letters = 0
lives = 0
wins = 0
loses = 0

batman = False

class GUI():
   def __init__(self, master):

      grid = Grid()
      self._master = master

      self._canvas = Canvas(self._master, height=250, width=250)
      self._canvas.grid(row=1, column=1, columnspan=7)

      global word
      self._label = Label(self._master, text=' ')
      self._label.grid(row=2, column=1, columnspan=7)

      self._alphabet = ['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']
      self._buttons = {}
      self._rgrid = 3
      self._cgrid = 1
      for self._letter in self._alphabet:
         self._command = partial(self.guess, self._letter)
         self._buttons[self._letter] = Button(self._master, text=self._letter.upper(), command=self._command)
         if self._rgrid == 3 or self._rgrid == 4:
            self._buttons[self._letter].grid(row=self._rgrid, column=self._cgrid)
            if self._cgrid == 7:
               if self._rgrid == 4:
                  self._rgrid = 5
               else:
                  self._rgrid = 4
               self._cgrid = 0
         elif self._rgrid == 5 or self._rgrid == 6:
            self._buttons[self._letter].grid(row=self._rgrid, column=self._cgrid, columnspan=2)
            if self._cgrid == 6:
               self._cgrid = 0
               if self._rgrid == 5:
                  self._rgrid = 6
         self._cgrid = self._cgrid + 1

      self._reset_b = Button(self._master, text='Reset Game', command=self.reset)
      self._reset_b.grid(row=9, column=3, columnspan=3)

      self._wLabel = Label(self._master, text="Wins: 0")
      self._wLabel.grid(row=9, column=1, columnspan=2)
      self._lLabel = Label(self._master, text="Loses: 0")
      self._lLabel.grid(row=9, column=6, columnspan=2)

   def guess(self, letter):
      global guessed_letters
      Guess(letter)
      self._buttons[letter].config(state=DISABLED)
      #guessed_letters = guessed_letters + letter
      #print guessed_letters

   def reset(self):
      start_game()
      for self._letter in self._alphabet:
         self._buttons[self._letter].config(state=NORMAL)
      self._canvas.delete("all")
      self._canvas.config(bg='white')

   def draw_post(self):
      line1 = self._canvas.create_line(25, 200, 25, 25)
   def draw_beam(self):
      line2 = self._canvas.create_line(25, 25, 125, 25)
      line3 = self._canvas.create_line(125, 25, 125, 30)
   def draw_head(self):
      head = self._canvas.create_oval(100, 30, 150, 80)
   def draw_batman(self):
      mask = self._canvas.create_oval(100, 30, 150, 80, fill="black")
      rect = self._canvas.create_rectangle(110, 65, 140, 80, fill="white", outline="white")
      outline = self._canvas.create_oval(100, 30, 150, 80)
      ear1 = self._canvas.create_polygon(105, 40, 115, 15, 120, 40, fill="black")
      ear2 = self._canvas.create_polygon(130, 40, 135, 15, 145, 40, fill="black")
   def draw_body(self):
      body = self._canvas.create_line(125, 80, 125, 160)
   def draw_rightArm(self):
      rightArm = self._canvas.create_line(125, 100, 150, 120)
   def draw_leftArm(self):
      leftArm = self._canvas.create_line(125, 100, 100, 120)
   def draw_rightLeg(self):
      rightLeg = self._canvas.create_line(125, 160, 150, 185)
   def draw_leftLeg(self):
      leftLeg = self._canvas.create_line(125, 160, 100, 185)

   def set_label(self, text):
      self._label.config(text=text)

   def set_canvas_color(self, color):
      self._canvas.config(bg=color)

   def set_Wins(self, lives):
      self._text = "Wins: " + str(lives)
      self._wLabel.config(text=self._text)

   def set_Loses(self, lives):
      self._text = "Loses: " + str(lives)
      self._lLabel.config(text=self._text)

def find(s, ch):
    return [i for i, ltr in enumerate(s) if ltr == ch]

def get_Word():
   wordlist = "words.txt"
   line_numba = random.randint(1, 113808)
   global word
   word = linecache.getline(wordlist, line_numba)

def deduct_life():
   global lives
   global word
   global loses
   global batman
   if lives == 8:
      gui.draw_post()
   elif lives == 7:
      gui.draw_beam()
   elif lives == 6:
      if batman == True:
         gui.draw_batman()
      else:
         gui.draw_head()
   elif lives == 5:
      gui.draw_body()
   elif lives == 4:
      gui.draw_leftLeg()
   elif lives == 3:
      gui.draw_rightLeg()
   elif lives == 2:
      gui.draw_leftArm()
   elif lives == 1:
      gui.draw_rightArm()
   elif lives == 0:
      gui.set_label(word)
      gui.set_canvas_color("red") # loss
      loses = loses + 1
      gui.set_Loses(loses)
   lives = lives - 1

def Guess(letter):
   global guessed_word
   global word
   global num_guessed_letters
   global total_letters
   global wins
   if letter not in word:      # Guessed incorrectly
      deduct_life()
   else:                  # Guessed correctly
      indexes = find(word, letter)
      gwList = guessed_word.split()
      for index in indexes:
         ri = (index - 2) + index
         gwList[index] = letter
         num_guessed_letters = num_guessed_letters + 1
      guessed_word = ' '.join(gwList)
      gui.set_label(guessed_word)
      if num_guessed_letters == total_letters:  # Win
         wins = wins + 1
         gui.set_canvas_color("green")
         gui.set_Wins(wins)

def start_game():
   global total_letters
   global num_guessed_letters
   global guessed_word
   global lives
   get_Word()
   total_letters = len(word) - 1
   guessed_word = '_ ' * total_letters
   gui.set_label(guessed_word)
   num_guessed_letters = 0
   lives = 8

root = Tk()
root.title("Hangman")
gui = GUI(root)
start_game()
root.mainloop()




Win:



Loss:



**replaced all the repetitious code and shrunk it like 100 lines.
** Added win/loss counters. One on each side of the "Reset Game" button

10
Scripting Languages / Re: How can I fetch emails through a proxy?
« on: October 20, 2013, 10:56:42 PM »
I have used urllib2, but that was unnecessarily hard so I switched to Requests(http://www.python-requests.org). Super easy, Its now the only http library I use.
There also should be some examples to use proxies on the website

11
General discussion / Re: Free 10tb cloud storage
« on: September 19, 2013, 02:19:15 PM »
Don't need it.

I have enough space on my 1TB to last me for a while and plus, if i need anything i can always buy another TB or just find space, in other places.


Or you could get 10 times that for free.........

12
General discussion / Re: Free 10tb cloud storage
« on: September 17, 2013, 11:37:28 PM »
Yea I hate free stuff too

13
General discussion / Re: Free 10tb cloud storage
« on: September 17, 2013, 04:07:39 AM »
Isn't that called EvilZone.org or Box? both give you tons of free storage especially EvilZone.org


But is it 10 terabytes?

14
General discussion / Free 10tb cloud storage
« on: September 17, 2013, 04:01:00 AM »
Yup. Free 10 terabyte cloud storage.
link: zc.qq.com


It is a chinese company, so it's all in chinese, but their site is easy enough to use. And if you intall the android app you get the free 10 tb storage. So you have to have an android phone.

15
Scripting Languages / Re: How to building GUI based applications in Python?
« on: September 17, 2013, 03:57:16 AM »
I'd go with tkinter for just starting. Its really easy to build and you can make it look eeeeehhhhhh so its not that bad. Just make sure to use the grid() and not pack it. packing is shit and hard to get to look nice

Pages: [1] 2 3 ... 16


Want to be here? Contact Ande, Factionwars or Kulverstukas on the forum or at IRC.