4,305 Posted Topics

Member Avatar for Niloofar24

One of the zillion rules of Kivy: Kivy looks for a .kv file with the same name as your App class in lowercase (minus “App” if it ends with ‘App’. eg. TutorialApp -> tutorial.kv) Compared to Python syntax, Kivy syntax really sucks. I would only use it if you have …

Member Avatar for vegaseat
0
4K
Member Avatar for happygeek

The U.S. government is creating a new agency to monitor cybersecurity threats. Let's hope these experts will take care of the abuse of the social media by Islamic State. Actually pastebin itself is abused by these folks.

Member Avatar for pixelsoul
4
671
Member Avatar for MustafaScript

abs(x) where x is an argument for the function abs() For example ... x = -123 print(x) print(abs(x)) From the manual ... abs(x) Return the absolute value of a number. The argument may be a plain or long integer or a floating point number. If the argument is a complex …

Member Avatar for vegaseat
0
224
Member Avatar for Niloofar24

Sooner or later you will use the pygame module anyway ... ''' pg_playmp3f.py play MP3 music files using Python module pygame pygame is free from: http://www.pygame.org (does not create a GUI frame in this case) ''' import pygame as pg def play_music(music_file, volume=0.8): ''' stream music with mixer.music module in …

Member Avatar for Niloofar24
0
30K
Member Avatar for iamthwee

The SharpDevelop IDE is a drag and drop GUI builder that writes most of the code for you either in C# or IronPython. With Mono it should work on Linux too?

Member Avatar for iamthwee
1
424
Member Avatar for Niloofar24

To create the layout you want use frames ... ''' tk_frame_pack101.py use Tkinter frames for different pack() layouts ''' # for Python3 change Tkinter to tkinter import Tkinter as tk root = tk.Tk() frame1 = tk.Frame() frame2 = tk.Frame() frame1.pack(side='top') # side='top' is default frame2.pack(side='top') # these widgets go into …

Member Avatar for vegaseat
0
4K
Member Avatar for Niloofar24
Member Avatar for Lardmeister

I used to go to the Milwaukee Brewers games and they had German Brats and Leinenkugel beer, a real gourmet feast. For the Superbowl I will go to a friend's house for barbecue (ribs and stuff). My friend is a Seahawks fan, so I better cheer for them. Should be …

Member Avatar for HiHe
0
463
Member Avatar for ShilohAmi

Generally you use the PyGame module to play sound and movies with Tkinter. See ... http://www.pygame.org/docs/ref/movie.html

Member Avatar for ShilohAmi
0
1K
Member Avatar for vegaseat

I used csv data readily available from http://www.weatherdatadepot.com/ to create a multiline plot of the average monthly temperatures of a given location.

1
330
Member Avatar for ShilohAmi

Another possibility (finds all occurrences of search) ... import numpy as np a = np.array([[1,2,1],[3,4,2],[6,5,3],[7,8,4]]) print(a) ''' [[1 2 1] [3 4 2] [6 5 3] [7 8 4]] ''' search = 2 for col, column in enumerate(np.transpose(a)): print(col, column) row = 0 for item in column: if item == …

Member Avatar for ShilohAmi
0
244
Member Avatar for A_Dubbs
Member Avatar for vegaseat
0
13K
Member Avatar for Niloofar24
Member Avatar for vegaseat

Two third party Python modules imageio and visvis make it easy to load and view images. The modules come with the pyzo scientific package or can be downloaded separately. Module imageio can read many image file formats as shown in http://imageio.readthedocs.org/en/latest/formats.html You could also replace your image file name directly …

Member Avatar for Ene Uran
4
7K
Member Avatar for Rohit_17

C++ and Python complement each other, so you should have a good knowledge of those two languages. Once you are learning C++ then Java isn't far off. Unless you are a genius, it will take a lot of coding and exploring to get to know Python thoroughly enough to pass …

Member Avatar for Lardmeister
0
215
Member Avatar for Niloofar24

ttk is included with Python27 on Debian Linux. What is your exact traceback error message?

Member Avatar for Gribouillis
0
12K
Member Avatar for vegaseat

With just about everybody snooping around your emails today with the excuse of hunting the bad guys, coding to keep some resemblance of privacy is getting important. I will start out with some simple encryption examples to get this started. You are invited to give us your thoughts and codes. …

Member Avatar for Lardmeister
3
1K
Member Avatar for RobertHDD
Member Avatar for RobertHDD
0
874
Member Avatar for Niloofar24

Module pickle is made for this ... ''' pickle_list101.py use module pickle to dump and load a list object use binary file modes "wb" and "rb" to make it work with Python2 and Python3 ''' import pickle mylist = [ 'Frank', 'Paul', 'Mary'] fname = "list101.pkl" # pickle dump the …

Member Avatar for snippsat
0
5K
Member Avatar for marcelocent

Since you are using the Windows OS see ... https://www.daniweb.com/software-development/python/code/490440/copy-to-and-from-the-clipboard-windows

Member Avatar for vegaseat
0
255
Member Avatar for Niloofar24

`favorite_movies = pickle.load( open("films.db", "rb"))` will give you a Python object like a list or dictionary, whatever you saved. You would have to process it to give you a meaningfull string you can display with `label['text'] = favorite_movies_string`

Member Avatar for sneekula
0
11K
Member Avatar for vegaseat

Knowing the longitude and latitude coordinates of two cities you can calculate the distance between them. Use the code in https://www.daniweb.com/software-development/python/code/490561/postal-code-zips-and-location-python to find the coordinates.

3
2K
Member Avatar for vegaseat

Using http://download.geonames.org/export/zip/ you can get postal information for most countries in the world. The raw data string can be transformed into a Python list of lists that can be searched for zip codes, locations, longitude and latitude coordinates.

2
4K
Member Avatar for kouty

You can study up on list comprehension ... mylist = [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18] size = 3 newlist = [mylist[n : n + size] for n in range(0, len(mylist), size)] print(newlist) ''' result ... [[0, 1, 2], [3, 4, 5], [6, 7, 8], [9, 10, 11], [12, 13, 14], [15, 16, 17], [18]] …

Member Avatar for sneekula
0
206
Member Avatar for kouty
Member Avatar for vegaseat

Using the Python win32 extensions it is relatively simple to copy to and from the clipboard. Sorry. the Windows OS is a requirement.

0
2K
Member Avatar for vegaseat

Just a small mildly optimized function to check if an integer is a prime number. For very large numbers use the Miller-Rabin primality test. There have been questions why I used `not n & 1` to check for even integer n. The more tradional` n % 2 == 0` is …

Member Avatar for vegaseat
2
3K
Member Avatar for sneekula
Member Avatar for shafter111

No, there is no "do ... while" loop in Python. A properly constructed while loop can do the same. If you have any problems, give us a simplified idea of what you want to accomplish. We will be glad to help!

Member Avatar for sneekula
0
31K
Member Avatar for cambalinho

@L7Sqr In all fairness SneeKula answered the original question. Sometimes it is fun to experiment a little to get to know the language better. Yes, I would rather use the tested `tolower()` and `toupper()` functions. Some instructors give these kind of problems to their students to make them think.

Member Avatar for sneekula
0
343
Member Avatar for vegaseat

A dictionary in Python is an unordered set of key:value pairs. I show you how to initialize, create, load, display, search, copy and otherwise manipulate this interesting container. Like the name says, it is the closest thing to a dictionary.

Member Avatar for Babe1
3
1K
Member Avatar for vegaseat
Member Avatar for throwaway123

One of the simpler Caesar ciphers can be done using Python's double-ended queue rotation.

Member Avatar for vegaseat
0
342
Member Avatar for Shaji_1

Something like this ... fname_in = "names_nocaps.txt" # write a test data file data = '''\ frank heidi karl ''' with open(fname_in, 'w') as fout: for name in data: fout.write(name) fname_out = "names_caps.txt" # read the file back in and write the modified data back out with open(fname_in, 'r') as …

Member Avatar for TrustyTony
0
307
Member Avatar for Stuugie

Potential freeloaders are all over the place. Nearly 50% of the US population now receives government handouts in one form or another. Food stamps/cards are a modern day soupkitchen in the USA. Great for those who are desperately down on their luck, but there is some abuse. Luckily in commerce, …

Member Avatar for Warrens80
3
393
Member Avatar for sneekula

It is my understanding that pillow has basicly taken over the further development of PIL.

Member Avatar for vegaseat
0
394
Member Avatar for vegaseat

Google Drive, Dropbox, iCloud, and OneDrive are all available to try for free (with limited storage). So far I have used Dropbox and OneDrieve and like Dropbox since it handles better on the PC and my iPad. OneDrive is improving and I have used iCloud on my iPad mostly for …

Member Avatar for RobertHDD
0
280
Member Avatar for happygeek
Member Avatar for Azmah

For an example see: [url]http://www.daniweb.com/software-development/python/threads/191210/1556772#post1556772[/url] Note: Programs like py2exe and cxfreeze simply package/combine necessary things (like code and interpreter) together and then unpackage it later to run on the users machine.

Member Avatar for kristopher.roller
-1
1K
Member Avatar for MasterChat

If you have plenty of electric energy and airconditioned buildings, then heat above body temperature is not too bad. Do your outdoor activities in the morning when it is usually a little cooler.

Member Avatar for RobertHDD
0
189
Member Avatar for vegaseat
Member Avatar for sweetsmile

A home water fall might help, add a little vinegar to the water. Nicotine is a base. We used to have carbon monoxide and cyanide detectors in the lab. They would go of if someone smoked nearby.

Member Avatar for sweetsmile
0
479
Member Avatar for Dacorncob
Member Avatar for Dacorncob
0
508
Member Avatar for EdJones

GUI toolkits like Tkinter can be used to draw strange three dimensional objects. Just play with it ... ''' tk_canvas_multi_circles101.py draw a series of circles to form 3D objects ''' try: # Python2 import Tkinter as tk except ImportError: # Python3 import tkinter as tk def draw_circle(x, y, radius, color): …

Member Avatar for vegaseat
0
6K
Member Avatar for vegaseat

If you draw a series of close spaced shapes your eyes get fooled to see Moire patterns. Here is one example of this.

2
2K
Member Avatar for itsnauman
Member Avatar for vegaseat
0
147
Member Avatar for IneedHELP2020
Member Avatar for vegaseat
0
113
Member Avatar for lyons18

Doing this with a low level language like C could most assuredly be a challenge. If you use a higher level language like Java or even Python, then this project might be much easier, for a Python example see ... https://www.daniweb.com/software-development/python/code/487171/google-translate-api-python Check out the Google translate API, I am sure …

Member Avatar for vegaseat
0
282
Member Avatar for avishekh.bharati

C++ has the Standard Template Library (STL) that makes your life so much easier when it comes to strings and vectors/arrays. See ... https://www.sgi.com/tech/stl/stl_introduction.html Also take a wiff of ... https://www.daniweb.com/software-development/cpp/code/216400/an-array-can-use-stl-functions Introduce yourself to classical OOP gradually, C++ allows this. A language that complements C++ very well is Python.

Member Avatar for vegaseat
0
192
Member Avatar for CharAmel

Hint ... // dirlist.c // display information about files // works with Pelles C and CodeBlocks #include <stdio.h> #include <io.h> // _findfirst() #include <time.h> // ctime() char *get_month(char *time_created); int main(int argc, char **argv) { // uses working directory if no args given char *spec = (argc > 1) ? …

Member Avatar for vegaseat
0
258

The End.