Master Python's itertools module by constructing practical examples. We'll start out simple and then gradually increase in complexity, encouraging you to "think iteratively."
Qt for Python (i.e. PySide2) was announced recently and got me interested in trying to use it to load up a UI file. If you don’t know, PyQt and PySide / PySide2 can use the Qt Creator application to create user interfaces using a drag-and-drop interface. This is actually very similar to the way you would create an interface using Visual Studio. Qt Creator / Designer will generate an XML file with a *.ui extension that you can then load inside of your PySide2 application (or PyQt).
Creating the User Interface
For this example, I opened up Qt Creator and went to File –> “New File or Project”. Then I chose the “Qt Widgets Application” choice. See screenshot below:
Then I opened up the mainwindow.ui that Qt Creator made for me. You can just double-click it or click on the Design button that should be on the left-hand side of the program. Here’s a screenshot that might help:
I added three widgets to my UI:
When I saved the file, I got the following in my UI file:
The ReportLab toolkit allows you to create interactive fillable forms. The PDF standard actually has a fairly rich set of interactive elements. ReportLab doesn’t support all of these elements, but it does cover most of them. In this section, we will look at the following widgets: checkbox radio choice listbox textfield All of these widgets are created by calling various methods on the canvas.acroform property. Note that you can only have one form per document. Let’s take a look at the widgets that ReportLab supports! Continue reading Creating Interactive PDF Forms in ReportLab with Python →
This blog post contains the slides along with a loose transcript and additional resources from my talk on appropriately marketing products to software developers that was given at Silicon Valley Bank during Ubiquity.VC's summit for founders, investors and technical... (read more)
How to actually execute Python code and run Python programs using the CPython REPL, executing script files, and integrated development environments.
This week we welcome Moshe Zadka (@moshezadka) as our PyDev of the Week! Moshe is a core developer of the Twisted project and he is also a co-author of Expert Twisted from Apress Publishing. He is also the author of a self-published book, from python import better. You can find additional information about Moshe here where he includes links to his Github, Instagram and blog. Let’s take a few moments to hear what he was to say. Can you tell us a little about yourself (hobbies, education, etc)? I am originally from Israel, and I currently live in the Bay area with my wife and my two kids (5yo and 3yo). Until I got married and life got too busy, I used to perform as Dr. Scott in a Rocky Horror Picture Show shadowcast. I intend to get back into performance once the kids are older! I started my life as a mathematician, published a paper (“Orbifolds as Diffeologies”), but then got into the software development world, and ended up as a DevOps Engineer. Continue reading PyDev of the Week: Moshe Zadka →
(издание 2018) Miguel Grinberg Туда Сюда Это двадцать третья часть Мега-Учебника, в которой я расскажу вам, как расширить микроблог с помощью интерфейса прикладного программирования (или API), который клиенты могут использовать для работы с приложением более прямым способом, чем традиционный рабочий процесс веб-браузера.
Building interactive maps into a Django web application can seem daunting if you do not know where to begin, but it is easier than you think if you use a developer tool such as Mapbox.
In this Python installation guide you'll see step by step how to get a working Python 3 distribution set up on Windows, macOS, Linux, iOS, and Android.
Писать на Python, используя IDLE или Python Shell, вполне удобно, если речь идёт о простых вещах, однако с ростом размеров проектов программирование превращается в мучение. С помощью IDE или даже хорошего редактора кода можно значительно упростить себе жизнь. Но вот вопрос — что выбрать?
Fillable forms have been a part of Adobe’s PDF format for years. One of the most famous examples of fillable forms in the United States are documents from the Internal Revenue Service. There are lots of government forms that use fillable forms. There are many different approaches for filling in these forms programmatically. The most time consuming method I have heard about is to just recreate the form in ReportLab by hand and then fill it in. Frankly I think this is probably the worst idea, except when your company is in charge of creating the PDFs itself. Then that might be a viable option because you then have complete control over the PDF creation and the inputs that need to go into it. Creating a Simple Form We need a simple form to use for our first example. ReportLab has built-in support for creating interactive forms, so let’s use ReportLab to create a simple form. Here is the code: Continue reading Filling PDF Forms with Python →
An overview of the Python programming language, including a brief history of the development of Python and reasons why you might select Python as your language of choice.
This week we welcome Kai Willadsen (@kywe) as our PyDev of the Week! He is the maintainer of the Meld project, a cross-platform visual diff and merge tool written in Python. You can catch up with Kai on his blog or see what else he is working on via Github. Let’s take a few moments to get to know Kai better. Can you tell us a little about yourself (hobbies, education, etc): I did undergrad in computer science + cognitive science, a PhD in complex systems modeling, and a variety of post-doc work before bailing on the academic life. None of the above is even remotely relevant to my current work though! My non-computer hobbies are basically gardening & chicken keeping. For people in the position to do so: if you’ve never kept chickens, think about it! They are the best. Continue reading PyDev of the Week: Kai Willadsen →
Python любят за многое, в том числе за его читабельность. Для улучшения читабельности кода и упрощения его поддержки существуют различные руководства. Один из самых известных — PEP8, описанный в официальной документации языка. И хотя это лишь набор рекомендаций, считается хорошей практикой им следовать. Пройдите наш тест и узнайте, насколько больно читать ваш код.
Data classes are one of the new features of Python 3.7. With data classes you do not have to write boilerplate code to get proper initialization, representation and comparisons for your objects.
As of Python 3.6, f-strings are a great new way to format strings. Not only are they more readable, more concise, and less prone to error than other ways of formatting, but they are also faster! By the end of this article, you will learn how and why to start using f-strings today.
Day 3 of PyCon 2018 began with a keynote from one of the longtime core developers of Python, Brett Cannon. He spoke on the struggles of working in open source and how we should treat each other with kindness throughout the process. I completely agreed with all his points as the negativity I see sometimes is quite discouraging. I try hard when I review books to not be too negative, for example. After the keynote, they had a poster session and job fair. The poster session is reserved for people who weren’t chosen to give a talk, but their proposal was still good enough for a poster. Or at least, that’s how it was explained to me when the first poster session occurred. I did notice that one of the talk speakers had a poster with the same name as her talk from the previous day, so maybe the rules have changed? I don’t know. I think my favorite was one about a Python keyboard where the keys were remapped to make it easier to program in Python. She had certainly done her research at any rate. The first talk I attended was Type-checked Python in the real world by Carl Meyer from Instagram. He was pretty persuasive in his talk about how powerful the typing module is and its usefulness. I had planned to go to Ned Batchelder’s talk, Big-O: How Code Slows as Data Grows, but I got distracted by another writing open space and one on education with Python. The latter was one I probably should have skipped as it was a continuation of a previous open space. There was a photo booth for people who wanted to take Mother’s Day photos for their loved ones and they had also set aside a room for people to call home in. I met a ton of people this time around, which was really neat. I met a number of core developers and a couple of people who have backed my projects on Kickstarter. I even got a photo with Guido! Overall, I think I learned a lot of interesting things and look forward to interacting with the Python community for many years to come.
This week we welcome Anthony Shaw (@anthonypjshaw) as our PyDev of the Week! Anthony is involved in several open source projects. You can read up on all of them over on his website. He also has a blog on Medium. Let’s take a few moments to get to know Anthony better! Can you tell us a little about yourself (hobbies, education, etc): I started programming from an early age and got into tech at school, studied Cybernetics at University in the UK and ended up working at a Cloud company for my first job. I’ve had all sort of roles, tech support, development, product management and my latest role I’m doing “skills transformation”, which is really about helping people learn new things, encouraging people to develop their tech skills and mentoring. I don’t code day to day for work anymore since I manage a team and have a lot of travel so I typically contribute to open-source projects in spare time and in between flights. I like to build things with my hands to switch off from work and IT, so I’m normally building something around the house, walls, landscaping or other big DIY projects. I live on the beach on the east coast of Australia so 9 months of the year I’m making any excuse to get in the water to swim. Continue reading PyDev of the Week: Anthony Shaw →
Day two of PyCon 2018 was kicked off with a few lightning talks. Next up were the keynotes. The first keynote was given by Ying Li from Docker. She spent her keynote talking about good security practices in the web and used a children’s book to illustrate her topic. It was kind of a fun talk and well delivered. The second keynote was the best keynote I have seen in a long time. It was given by Qumisha Goss who is a librarian at the Detroit Public Library where she specializes in technology. She is a certified Raspberry Pi teacher and teaches Python to 6-17 years olds. It was an inspiring keynote and talked a lot about how we need to reach out across boundaries and ages and teach one another to break down barriers. I highly recommend you watch this keynote if you have a few minutes to spare! Continue reading PyCon 2018 – Conference Day 2 (May 12) →
PyCon 2018 in Cleveland, Ohio kicked off their first conference day with an introduction from one of Cleveland’s natives, Ernest W. Durbin III. Then we moved on to the keynote of the morning which was given by Dan Callahan from Mozilla. He talked about tooling and how Python currently doesn’t have a big presence on the web. It was actually quite interesting and also a bit disappointing as there wasn’t really a true solution given. However his talk was quite good and insightful. Continue reading PyCon 2018 – Conference Day 1 (May 11) →
PyCon US 2018 kicked off today with the first day of tutorials. I am flying in tomorrow and will be there through the end of the weekend. If you're around, come by either the Twilio booth or the... (read more)
ORM весьма полезны для разработчиков, но абстрагирование доступа к базе данных имеет свою цену. Разработчики, которые решили покопаться в базе данных, обнаруживают, что некоторые вещи можно было сделать проще. Представляем вашему вниманию 9 советов по работе с базами данных в Django.
Editor’s note: This week we have a guest post from Alex, the CEO of CheckIO In life we always have options whether we know about them or not. It’s the same with coding. There is a fair amount of different ways in which we can approach a particular task. We might not consider those ways, or have no clue about them, but there they are. Being a coder is not just about knowing the language and the process of writing a code. Very often being a coder means being the most creative version of yourself considering what you’ve never considered before. And on this note I’d like to introduce myself. Hi! My name’s Alex, I’m a CEO at CheckiO and I’ve been dealing with the creative aspects of this project for quite some time. Our users are of different coding knowledge levels and experiences, that’s why I often see the standard and more obvious task solving approaches. But from time to time I come across such unique and unordinary solutions that make me once again learn new subtleties of the language. In this article I want to go over some of the solutions to one of a very simple tasks which in my opinion are the most interesting ones. The mission requires from you to write a function that will determine whether all array elements have the same value. Continue reading Determining if all Elements in a List are the Same in Python →
A tutorial to help you leverage built-in functions and operators in your custom Python classes, and use them in a meaningful way for your objects.
A performance comparison between pure Python, NumPy, and TensorFlow using a simple linear regression algorithm.
This week we welcome Elizabeth Sander as our PyDev of the Week! Elizabeth is a data scientist at Civis Analytics. She has her own website where you can learn a lot of interesting background information about her. If you are more interested in her open source projects, then her Github profile may be what you really want to check out. Let’s take a few moments to get to know Elizabeth better! Can you tell us a little about yourself (hobbies, education, etc): My background is actually in computational biology, basically looking at how food webs are structured, and how to predict network structure from other kinds of data. I was bitten by the software bug in grad school. I tried to turn all of my research into software packages, or at least a series of scripts that could reproduce my work. This is surprisingly uncommon in academia, at least in ecology! I finished my Ph.D. in Ecology and Evolution last year, and now I’m a R&D data scientist at Civis Analytics. Now I get to work on software to help other data scientists do their job, which is a fun balance of programming and analysis. I have lots of hobbies outside of software, maybe a few too many. I do a lot of circus arts, especially trapeze and contact staff, and I have a lot of crafty hobbies like sewing and knitting. I’m also a big gamer, whether it’s board games, role playing games, or video games. Continue reading PyDev of the Week: Elizabeth Sander →
There are many times where you will want to extract data from a PDF and export it in a different format using Python. Unfortunately, there aren’t a lot of Python packages that do the extraction part very well. In this chapter, we will look at a variety of different packages that you can use to extract text. We will also learn how to extract some images from PDFs. While there is no complete solution for these tasks in Python, you should be able to use the information herein to get you started. Once we have extracted the data we want, we will also look at how we can take that data and export it in a different format. Let’s get started by learning how to extract text! Extracting Text with PDFMiner Probably the most well known is a package called PDFMiner. The PDFMiner package has been around since Python 2.4. It’s primary purpose is to extract text from a PDF. In fact, PDFMiner can tell you the exact location of the text on the page as well as father information about fonts. For Python 2.4 – 2.7, you can refer to the following websites for additional information on PDFMiner: Github – https://github.com/euske/pdfminer PyPI – https://pypi.python.org/pypi/pdfminer/ Webpage – https://euske.github.io/pdfminer/ PDFMiner is not compatible with Python 3. Fortunately, there is a fork of PDFMiner called PDFMiner.six that works exactly the same. You can find it here: https://github.com/pdfminer/pdfminer.six Continue reading Exporting Data from PDFs with Python →