Python Daily
2.57K subscribers
1.48K photos
53 videos
2 files
38.9K links
Daily Python News
Question, Tips and Tricks, Best Practices on Python Programming Language
Find more reddit channels over at @r_channels
Download Telegram
Detailing PyTermGUI's brand new layout system

https://preview.redd.it/22cp2zza29z81.png?width=3090&format=png&auto=webp&s=9c4d46c4261cb7f76b6b542bd376bf00ccdcd491

The most popular request I've gotten related to my terminal UI library, PyTermGUI, was a way to create pre-defined layouts. This came alongside the question of "why focus so much on floating layouts?". Well, the reason is basically this update.

I knew for a long time that while implementing a layout system my biggest problem would be coming up with a sensible API (Funnily enough, the part of the layouts that actually arranges the windows on the screen is 3 lines of code). Because of the early focus on windowing support, implementing the new layout system brought the library to a best-of-both-worlds situation, as it's a lot harder to implement windowing into a tiled layout than vice-versa.

Here is an example of the API I ended up settling on. The code in question creates the layout seen above.

layout = Layout()
layout.addslot("Header", height=5)
layout.add
slot("Header Left", width=0.2)

layout.addbreak()

layout.add
slot("Body Left", width=0.2)
layout.addslot("Body", width=0.7)
layout.add
slot("Body Right")

layout.addbreak()

layout.add
slot("Footer", height=3)

As you can

/r/Python
https://redd.it/uot805
Django Q query

Is this

Poll.objects.get( Q(questionstartswith='Who'), Q(pubdate=date(2005, 5, 2)) | Q(pubdate=date(2005, 5, 6)) )

same as

Poll.objects.get( Q(questionstartswith='Who') & ( Q(pubdate=date(2005, 5, 2)) | Q(pubdate=date(2005, 5, 6)) ) )

​

/r/django
https://redd.it/up5fkq
Clearing up hard drive

First of all I am new to python. So after I plotted my data (there were huge data points) I noticed around 8 gb in my c drive was gone. Actually I have noticed this earlier. When ever I run a code, I find a noticible difference in my hard drive. So is python saving my data points in my pc or something? And how to clean up my hdd memory? Thanks

/r/IPython
https://redd.it/unf3u8
Jupyter Notebook Competition Webinar 19 May

The Jupyter Notebook Competition is now well underway!

https://preview.redd.it/9rvusn7gz1z81.png?width=4400&format=png&auto=webp&s=74deb750c81078abe3d6e8efc5334693e156aff2

Still not sure if you'll enter? Join our webinar on 19 May where you'll learn more about how to build a community-driven resource of notebooks!

Enter into the race to win cash prizes - register at: https://us02web.zoom.us/webinar/register/WN\_yHQrZ0ySRx-IIK7wmXzZUA

/r/JupyterNotebooks
https://redd.it/uo21tc
Help me to repreesent images side by side using Flask

Hi guys. Assume I have a dictionary and render it to html page. I'm using for loop like:

{% for img in dics %}

<img ...>

{% endfor %}

so it print out images but after each loop, next image is printed in new line. But I'm hoping it's side by side. So how can I do it? Is it can solved by using Jinja2 or it's related to CSS. Sorry for my bad English and thanks for your answers!

/r/flask
https://redd.it/upa0n5
Saturday Daily Thread: Resource Request and Sharing! Daily Thread

Found a neat resource related to Python over the past week? Looking for a resource to explain a certain topic?

Use this thread to chat about and share Python resources!

/r/Python
https://redd.it/up4vg6
hey is there anny option to remove obj from table but not delete from DB?

for example i got start and stop button i want with the stop button that the obj removes from todays jobs. Anny functions ?

/r/django
https://redd.it/upge19
i want to Redirect to the same view after delete??

**so after deleting comment i can't back to detailviews of my comments , i need back with the pk of the post**

\#error

`Reverse for 'CommentsBack' not found. 'CommentsBack' is not a valid view function or pattern`



#views
# list all the comments of ever post l
class comment_back (DetailView):
model=Post
template_name='CommentsBack.html'

#delete comment by his primary key
def delete_comment(self,pk):
event=Comment.objects.get(pk=pk)
event.delete()  
return redirect('CommentBack')

&#x200B;

#urls

path('mypost/<int:pk>/commentBack', comment_back.as_view(),name="commentBack"),
path('DeleteComment/<int:pk>/remove', views.delete_comment,name="delete_comment"),

/r/djangolearning
https://redd.it/uplkto
Hi all , weird one happening for me tonight . Started a new project and created my first few tables . When I created a super user via manage.py shell it won’t let me log in to /admin/

Any idea why it’s not allowing me in ?

/r/django
https://redd.it/upr3t4
Biometrics Enrollment in Django.

Please who has an idea on biometrics enrollment using Django? I am currently working on a web application that requires fingerprint capturing from users. The fingerprints are captured and saved to the database and users can also login through their username and their fingerprints.

Please I need your suggestions.

Thank you.

/r/djangolearning
https://redd.it/uph56b
Hey, I have question on how adding a click event to my plotly object in a dash app. Actually, I am trying to open the ensembl website by clicking on a scatter structure (see figure attached) inside my plotly figure.

/r/IPython
https://redd.it/n5doto
Sunday Daily Thread: What's everyone working on this week?

Tell /r/python what you're working on this week! You can be bragging, grousing, sharing your passion, or explaining your pain. Talk about your current project or your pet project; whatever you want to share.

/r/Python
https://redd.it/uptmup
How do you name the project directory?

It is about convention so I can do whatever I want at the end of the day. But let me ask this question.

By "project directory" I mean the inner mysite/ directory in the official Django tutorial.

In the official tutorial, the outer directory and the inner directory have the same name and I find it kind of confusing.

So I named it "config". But something doesn't feel right.

And I still find it confusing because you can have other config files or directories when developing with Django such as setup.cfg and pre-commit-config.yaml etc...

I prefer "project_config". But the name's kinda long and as far as I know, nobody uses it.

Some people apparently prefer"project".

https://forum.djangoproject.com/t/project-naming-conventions/339

What do you think about the name "project_config"? Redundant?

And how do you name the project directory?

/r/django
https://redd.it/uq06st
I made a package that prints trees to the console

&#x200B;

https://preview.redd.it/ig0oabgn6lz81.jpg?width=469&format=pjpg&auto=webp&s=5d4114e527373799d18d77d193f1071f1c6c13c0

https://github.com/AharonSambol/PrettyPrintTree

I couldn't find any good way to print trees to the console... So I made one :)

It helps a ton with debugging!

/r/Python
https://redd.it/uq0bdo