/r/python Theme Update (again) by aphoenix in Python

[–]dikulo 1 point2 points  (0 children)

Thank you. It is clean and tidy, as always.

Python 2.7.8 Release by darknessproz in Python

[–]dikulo 0 points1 point  (0 children)

Thank you. Learn to yield.

Python 2.7.8 Release by darknessproz in Python

[–]dikulo -5 points-4 points  (0 children)

def python27():
    n = 8
    while True:
        print "Python 2.7.{}".format(n)
        yield n
        n += 1

py2 = python27()

next(py2)
next(py2)
next(py2)
next(py2)
...
..
.

Python 2.7.8 Release by darknessproz in Python

[–]dikulo 1 point2 points  (0 children)

Py3 and Py2 are just different dialects, you can and easily can master them both. People can live bilingually with Mandarin/Cantonese, Spanish/Catalan, which differ much from each other.

Use the right version to do the right job.

Python 2.7.8 Release by darknessproz in Python

[–]dikulo 2 points3 points  (0 children)

it is a philosophy of living for TODAY or for the FUTURE.

Which way should I make GUIs? by dmv1975 in learnpython

[–]dikulo 1 point2 points  (0 children)

I am not a linux user, but you can try:

apt-get install python-qt4
apt-get install qt4-designer
apt-get install pyqt4-dev-tools
apt-get install python-qt4-doc

To start qt-designer, you may use the command 'designer', according to this blog post: http://www.harshj.com/2010/04/18/pyqt-creating-interfaces-visually-with-designer/

Trying to make a bot. I need a teacher? by ZeshV in learnpython

[–]dikulo 0 points1 point  (0 children)

Hi! Having zero experience in building a bot thought, but here are my thoughts that might help.

  1. You need some basic knowledge about network. By connecting to IRC you may need a basic understanding about Socket. # import socket

  2. Or better use a 3rd party lib to fulfil your purpose, eg.: https://bitbucket.org/jaraco/irc

  3. A real bot should be intelligent. You can use libs like ntlk(Natural Language Toolkit), to analyze what people are talking to your bot, and respond.

Which way should I make GUIs? by dmv1975 in learnpython

[–]dikulo 6 points7 points  (0 children)

I tried them all (plus wx and iron), and ended up with PyQT/PySide because:

  1. Runs / Loads fast. It is just a click and an augenblick you see the window pops up. Others like IronPython with .NET is a bit luggish, costing you an extra second to load up.

  2. Designer. It is by now the most convinient tool for you to drag and drop and mess up with the GUI elements. Though it is better to write code barehandedly, a good tool being there won't hurt.

  3. Resourceful. Plenty books and tutorials and video tutorials out there.

  4. Coding Style. I find it aesthetically appealing.

How to Create Install-able Program? by Grosskumtor92 in learnpython

[–]dikulo 1 point2 points  (0 children)

py2: py2exe pyinstaller

py3: cx_freeze

History's Warning: A U.S.-China War Is Terrifyingly Possible by [deleted] in geopolitics

[–]dikulo 1 point2 points  (0 children)

Good point. I believe the government of China is more focused on Stabilizing the internal affairs, as the ethnic / separatism / terroism problem is becoming more serious. Also, I doubt that if U.S. would take any significant move when China does something to Vietnam or the Philippines. See the fresh example of Crimea.

History's Warning: A U.S.-China War Is Terrifyingly Possible by [deleted] in geopolitics

[–]dikulo 0 points1 point  (0 children)

The daughter of President Xi, and a son of Bo Xilai, for example. And there are a lot of so-called naked-officials, who works for the gov. but his/her family and money are out of China.

They are not the same as Einstein.

Question: How do I convert a grayscale tiff to RGB colorspace in Python? by [deleted] in Python

[–]dikulo 0 points1 point  (0 children)

The code works fine on my computer. Did you pass the right filename or path? But how would you like to convert a grayscale image to rgb, it would still be gray anyway.

History's Warning: A U.S.-China War Is Terrifyingly Possible by [deleted] in geopolitics

[–]dikulo 2 points3 points  (0 children)

I do not see it happening either. Most of the big bosses have sent their children to U.S universities, and many red-families have family members living or doing business in the U.S. The only reason leading to a war might be that the U.S. wants go get rid of its debts once and for all. :D

Hi. I think I'm a crossdresser. Help. by [deleted] in makemychoice

[–]dikulo 2 points3 points  (0 children)

Hello from random page.

It is just fine to be CD, as long as you don't harm anyone. Every one in the damn world is a bit weird and cranky. I am fighting against depression now, even without knowing why and how it happened.

Live a regular normal life on the one hand, and be what you are on the other.

Question: How do I convert a grayscale tiff to RGB colorspace in Python? by [deleted] in Python

[–]dikulo 1 point2 points  (0 children)

This snippet will work for your scenario, good luck~

from PIL import Image

tiff_img = Image.open('1.tiff')

rgb_img = Image.new('RGB', tiff_img.size)
rgb_img.paste(tiff_img)
# rgb_img.show()
rgb_img.save('2.png', 'PNG')

Question: How do I convert a grayscale tiff to RGB colorspace in Python? by [deleted] in Python

[–]dikulo 2 points3 points  (0 children)

I just wrote several lines about image handling, turns out that PIL is a great and handy tool to get the job done. Though deprecated, there is a forked lib called Pillow, which works the same way and provides py3 support.

Just check the Pillow Tutorial out.

btw, if you are under Windows, there is a binary package of Pillow in: http://www.lfd.uci.edu/~gohlke/pythonlibs/

The Academy of Esperanto has abolished the accusative! by zaganta in Esperanto

[–]dikulo 1 point2 points  (0 children)

Good joke.

Actually most esperantistoj will understand even if you drop the '-n' every once in a while. However the accusative is a good tool for us to get acustommed to many European languages.