richieking 44 Master Poster

take away the "\n".join

It should be ok.

for x in str(dc):
  print x
richieking 44 Master Poster

But we are not in a hurry. Soo many versions for what? Yea for dependancies and headache kum sleepless night for newbie's.

I meant , why cant we have LTS releases??? A stable widely accepted stuff than version upon version and mess upon mess without measure!.

I love pyhon cos i like to be lazy and its the good tool to save my butt but however... its a nightmare when your code today does note work tomorrow due to multiple unnecessary releases.

Its just like ubuntu that a liltle change to a chicken leg brings in another BOOMBOOM version. Stability is very important.

I love ubuntu and python. I am using both and always have but they makes me very angry with how they carry things around. At least Mr. Ubuntu got LTS.

Dont make a mistake. yea... python is not ubuntu but at least the idea of stabilty for a software, system, tool etc are the same.

Long live the snake!!!!! :)

richieking 44 Master Poster

do this.

print("\n".join(x for x in dc))

The dc is a list. You need to run iter it.

richieking 44 Master Poster

Slice what? which part???? can you please provide more info and any code you have .

:)

richieking 44 Master Poster

Not bad...

Nice stuff ;)

richieking 44 Master Poster

I think the speed of new releases of python is not a good idea. Python have so many releases and they break things.

GUI's like wx,QT,GTK cant keep up with this mess. I know tk is there. But who uses tk for serious stuff.?
Why cant they make LTS releases. Say every 2/3 years and keep patching the baby when needed?

If a platform is not uniform, people runs for safety.... meaning other platform/tool.. Coming from C++ to python was a breeze. I like python... i mean love ;) but i hate the nonsence,ideas and ways of its management.

Python is a great tool if looked after very well without this useless race. ;)
Python is here to stay but hay.... we cant keep up with this race. Stop breaking our stuffs guys!
Thats my take ;)

richieking 44 Master Poster

hhhhmmmmmmmmmmmmmmmmmmm ;)

richieking 44 Master Poster

can you be more specific with your win explorer?

;)

richieking 44 Master Poster
richieking 44 Master Poster

Run this code

#! /usr/bin/env python
# -*- coding: UTF-8 -*-
import turtle
def initialize ( color = "blue" , smallest = 1.0 ) :
    turtle.clear ( )
    turtle.up ( )
    turtle.goto ( -100.0 , 100.0 )
    turtle.setheading ( 0 )
    turtle.colour ( colour )
    turtle.down ( )
global smallestLineLength
smallestLineLength = 90
def TornSquare ( overallLength ) :
    halfSideLength = int (( 0.9 * overallLength ) / 2.0)
    if  halfSideLength <= smallestLineLength :
       moveFunction = turtle.forward(100)
    else :
      moveFunction = TornSquare
    a = 85
    b = 180 - 2 * a
    moveFunction = halfSideLength
    turtle.right ( a )
    moveFunction = halfSideLength
    turtle.left ( 180 - b )
    moveFunction = halfSideLength
    turtle.right ( a )
    moveFunction = halfSideLength

def TornSquareFractal (overall , smallest = 1.0 , color = "blue")  :   
    TornSquare ( overall )
    turtle.right ( 90 )
    TornSquare ( overall )
    turtle.right ( 90 )
    TornSquare ( overall )
    turtle.right ( 90 )
    TornSquare ( overall )

if __name__ == "__main__" :
    #initialize ( ’brown’ , 100 ) ; cesaroLine ( 200 )
    TornSquareFractal ( 200.0 , 10.0 , "brown" )
    raw_input ( "Press enter to end" )

And dont forget to upvote my a lil more ok ;)
Your initialize method up there is useless for now ;)

richieking 44 Master Poster

number 12 and 15.

You made a comparism to

#
smallestLineLength = "smallest" ## this is a string

def TornSquare ( overallLength ) :

halfSideLength = int (( 0.9 * overallLength ) / 2.0)

if 'halfSideLength' <= smallestLineLength : # you are comparing a string.... No good for you here. I must be some sort of int data/float to determine movement. As far i am concern, this comparism is useless.

Keep refactoring ok? ;)

richieking 44 Master Poster

Hi, look

on line 21-25

moveFunction is not a function but a variable.

why are you calling

moveFunction ("bla bla")

instead of

moveFunction ="bla bla"

Fix that ok ;)

MUFC4life commented: Very helpful +1
richieking 44 Master Poster

Can you post your code again with your import modules if any.
Just in short what you have provided is not enough to help assist you.
:)

richieking 44 Master Poster

why no close this thread and try django forum. I will do that if i were you.
;)

richieking 44 Master Poster

Nice one woooee

i think using new as a variable is not ok. I know you know that anyway that new is a reserved object.

In all, i like your sleakness . Bravo ;)

richieking 44 Master Poster

#
def enqueue(element, queue):

"""Insert an element into the back of the queue"""

newnode = ListNode(element)

if empty(queue):

queue.up = newnode

elif empty(queue):

queue.down = newnode

elif empty(queue):

queue.left = newnode

else:

queue.right = newnode

What is the logic here? Very redundant method i see.
Besides you do not have a proper class grip hence data are not called and sync'ed well. Please break your codes into parts and repost them one after other as i like running away from 50 lines of code at one go.
;)

richieking 44 Master Poster

Is there not a normal way to do this??

templating i think?

;)

richieking 44 Master Poster

Staright forward buddy ;)

richieking 44 Master Poster

Quick work out.

have fun

from random import *


while 1:
  ime_f = raw_input("Vnesi ime fanta: ");
  priimek_f = raw_input("Vnesi priimek fanta: ");
  ime_z = raw_input("Vnesi ime deklice: ");
  priimek_z = raw_input("Vnesi priimek deklice: ");
  x = randint(0, 70);
  if ime_f == "Lojze" and priimek_f == "Slak" and ime_z == "Mihela" and priimek_z == "Cas":
    print "Ujemanje je 100%";
    break
  else:
     print x;
richieking 44 Master Poster

does python got a module for that?

richieking 44 Master Poster

pydev plugin to eclipse/aptana also allow you to choose your taste. ;)

vegaseat commented: thanks for the info +13
richieking 44 Master Poster

like i stated on the top.

simple format print

;)

richieking 44 Master Poster

simple format print

stuff="""
      Hi folk, I fairly new to Python 2.7 and Python 3 and
      like to find out how I would get a print to appear in
      the middle of the output screen without putting in a
      load of spaces into a print statement. Please keep it
      simple for me.
      """
print("%20s"% stuff) ## increase the figure  for more indentation

flavours ;)

richieking 44 Master Poster

You will need to time and threading modules very carefuly.

They can make your life more easier.
;)

richieking 44 Master Poster

You can use wx.Timer to bind to self to do that job.

eg.

import wx

class Frame(wx.Frame):
    """
    #Class stuff decl
    """
    def __init__(self,parent):
        wx.Frame.__init__(self,parent)
        self.timer=wx.Timer(self)
        self.count=0
       
        #timer event Always must be bound to self
        self.Bind(wx.EVT_TIMER,self.evt_timer)
        self.Bind(wx.EVT_PAINT,self.paint)
        self.Show()
        ############### event  methods ###########
    def paint(self,event):
        self.timer.Start(100)# increase the value for more time
            
    def evt_timer(self,event):
        self.count +=1
        if self.count== 20:
            # Do your more stuff here
            print ("hello world")  
            self.count=0 # reset the count
            
if __name__ =="__main__":
    app=wx.App()
    Frame(None)
    app.MainLoop()

This should help you for now......
;)

richieking 44 Master Poster

And try not to use keywords as a variable name.

on line 23. the new keyword. ;)

richieking 44 Master Poster

What you need is a language directory with your languages files.

So you open the file to read on the fly and use the names to populate where needed in your application.

You must have a wx.choice control listing all your languages and as the user make his/her choice , it triggers event and the method for the even takes care you swapping the languages. Very simple ;)

richieking 44 Master Poster

i dont think you wrote this code yourself. Any way what is the problem with your application?

;)

richieking 44 Master Poster

To show icon on the top bar and the panel.....
use this

import wx

class Fra(wx.Frame):
    def __init__(self,parent):
        wx.Frame.__init__(self,parent)
        
        self.ico=wx.IconFromBitmap(wx.Bitmap("/home/richie/icon.xpm"))#path to icon
        self.SetIcon(self.ico)
        
        self.Show()
ap=wx.App()
Fra(None)
ap.MainLoop()

Just change the path to your icon

###############################################################################
# To set a bitmap on your frame use this.

import wx

class Fra(wx.Frame):
    def __init__(self,parent):
        wx.Frame.__init__(self,parent)
        
        pan=wx.Panel(self,-1)
        pic=wx.StaticBitmap(pan)
        pic.SetBitmap(wx.Bitmap("/home/richie/o.png"))
        
        self.Show()
ap=wx.App()
Fra(None)
ap.MainLoop()

They are to give you the idea how powerful wxpython is...

richieking 44 Master Poster

go to this link.
http://beaker.groovie.org/index.html

As python was not 100% made for web development like php etc...
for sessions and cookies.... Python is more towards sofware development

Download the module and easy-install it. You can just use it. very handy

richieking 44 Master Poster

your error was expalined i think.
no module name regex.

import re as regex

thats if you cant do without regex.
;)

richieking 44 Master Poster

why not. you can install more than 1 version.

Are you on linux ,OSX or windows?
if linux, what flavour?
;)

richieking 44 Master Poster

They work the same, they need the same data type.

socket.connect((11.11.111.11,"1911")) 
##OR
 socket.bind((11.11.111.11,"1911"))

;)

richieking 44 Master Poster

can you please paste your code again in the code tags .;) we need this...

richieking 44 Master Poster

Your code is not bullet proof. its far from ok.

And i was thinking why dont you break them apart into methods in a class. It will be more handy and easy to work on it.

richieking 44 Master Poster

because seticon only set icon for your frame that is the little icon on the bar far left.

What are you trying to achieve?

;)

richieking 44 Master Poster

And where is his code?

no hands?????
;)

richieking 44 Master Poster

urllib module.... read about that

may help
;)

richieking 44 Master Poster

where is your visual module?

richieking 44 Master Poster

where and on what data you want to use the random, keywords or the txt file?

richieking 44 Master Poster

Do you still need this???

refactor needed i think
;)

richieking 44 Master Poster

why cant you simply use

name,age=raw_input(" Name and age please:..  ").split()

Save your self from trouble will you? ;)

richieking 44 Master Poster

mmmmm lets see

richieking 44 Master Poster

Your wish list is very strange however itertool permutation module may help you. Just figure what you are looking for because values entered and results wished are far apart.

;)

richieking 44 Master Poster

I dont see why you cant change that. You extended the wx.Frame class so you can overide methods and variables in your calss if you want.

The only problem i see is your gridsizer not well coded hence breaks apart when expanded.

;)

richieking 44 Master Poster

As griswolf pointed to you about you using dict to save your item values its one of the best advice for you.

Your data are more static and moreoevr you have paired them in a staic way which you pull the results from the lists. Its not efficient. You need a key and value stuff, a hash data type which is a dict in python.

Besides you code loop works fine with me.

Work on that.. ;)

richieking 44 Master Poster

i will wait till you put your code in the code tag tomorrow before i comment.
;)

richieking 44 Master Poster

well this is a way to atleast find a word and its position out.

from __future__ import print_function
list= ["gene","fooo","spam","spat","foo","gene","geni","spilat"]
print([(count,gene) for count,gene in enumerate(list)if gene=="gene"], end="")

##output
[(0, 'gene'), (5, 'gene')]

Hope it helps
;)

richieking 44 Master Poster

I just install the girl(graphics). I just found out that the frame and image quality is not as smooth as wxpython.

But its a cool module to play with ;)

richieking 44 Master Poster

i am going to install this graphics module now. ;)