Go to advanced search

by yfpiLiker
Sat Oct 13, 2018 5:32 pm
Forum: Python
Topic: picamera and Flask - numpy issue
Replies: 4
Views: 666

Re: picamera and Flask - numpy issue

That looks much better documented and easier to use!
by yfpiLiker
Thu Oct 11, 2018 6:39 pm
Forum: Python
Topic: importing modules from other directory paths
Replies: 9
Views: 869

Re: importing modules from other directory paths

@Loonhaunt: Please put your code between code tags for better reading.
You can insert them with the Code button on top of the Post reply entry.
by yfpiLiker
Thu Oct 11, 2018 6:30 pm
Forum: Python
Topic: Python camera
Replies: 2
Views: 413

Re: Python camera

What's your code?

How do you connect your Mac to the Pi?
by yfpiLiker
Thu Oct 11, 2018 6:17 pm
Forum: Python
Topic: picamera and Flask - numpy issue
Replies: 4
Views: 666

Re: picamera and Flask - numpy issue

But isn't frame a instance of type Mat?
by yfpiLiker
Wed Oct 10, 2018 11:16 am
Forum: Python
Topic: Using global variables in functions with if statements
Replies: 7
Views: 1712

Re: Using global variables in functions with if statements

I am a bit confused by the recent discussion because the original issue seems to be that when Python terminates, then is run again, the variable data doesn't automatically persist from the previous execution. Mithras01 said that doesn't know how python works, so I explaned it. In the 2. post Mithra...
by yfpiLiker
Tue Oct 09, 2018 7:03 pm
Forum: Python
Topic: Error handling with PiCamera
Replies: 3
Views: 552

Re: Error handling with PiCamera

I discovered part of the reason it was not exiting cleanly is because it was not tidying up the PiCamera object. I added camera.close() After it takes the picture and I do at least have a script that can be run more than once without rebooting. It workd like file objects! You can add a try .. final...
by yfpiLiker
Tue Oct 09, 2018 6:47 pm
Forum: Python
Topic: Pi Python development on Windows
Replies: 9
Views: 2481

Re: Pi Python development on Windows

So I would install Spyder on te pi. You can download it with apt install. (I used synaptic) And then us RDP or VNC to work on the pi and start Spyder there. Check Spyder out: https://www.spyder-ide.org/ You can use RDP on Windows with the pre-installed Remote Destop ?Connection?. I am also mostly wo...
by yfpiLiker
Tue Oct 09, 2018 6:35 pm
Forum: Python
Topic: Using global variables in functions with if statements
Replies: 7
Views: 1712

Re: Using global variables in functions with if statements

Mybe it's because of the Motor or the functions for it.

Also why do you write this:

Code: Select all

forward(int(10) / 1000.0, int(512))
You don't need to convert an integer into an integer. '10' is already one.
by yfpiLiker
Tue Oct 09, 2018 6:30 pm
Forum: Python
Topic: Using global variables in functions with if statements
Replies: 7
Views: 1712

Re: Using global variables in functions with if statements

So actually the website is not wrong at all, but the global module isn't working. you can't import global like this: import global because it's a keyword it also doesn't work if you name the file "global_.py" and import it as global_ @Mithras01 : which version of python are you using? Your programm ...
by yfpiLiker
Tue Oct 09, 2018 6:16 pm
Forum: Python
Topic: Using global variables in functions with if statements
Replies: 7
Views: 1712

Re: Using global variables in functions with if statements

More on... How to Global Variable in Python This website is wrong you can easily copy the scripts and check them. (what i did) So in python it's like this: When you start a script, a new namespace is created. If create a function, also a new namespace will be created, but it will be inside of the o...
by yfpiLiker
Tue Oct 09, 2018 8:36 am
Forum: Deutsch
Topic: Motion - eMailversand mit Bild
Replies: 2
Views: 2245

Re: Motion - eMailversand mit Bild

Wie meinst du das?

Was ist "on_event_end" ?
by yfpiLiker
Tue Oct 09, 2018 8:32 am
Forum: Deutsch
Topic: import von Modulen/Klassen
Replies: 2
Views: 2041

Re: import von Modulen/Klassen

Genau!!

Code: Select all

import sys

path = "/verzeichniss/indem/dein/Programm/liegt/"  # auf dem pi (linux)

sys.path.append(path)

import modul
by yfpiLiker
Tue Oct 09, 2018 8:26 am
Forum: Deutsch
Topic: Auswertung einer Tischtennis Zähltafel
Replies: 6
Views: 2320

Re: Auswertung einer Tischtennis Zähltafel

Kamera und OCR. Den Text der aus der Texterkennung heraus kommst, kannst Du dann nach dem Ergebnis parsen. Du machst einfach einmla die Sekunde ein Bild und schickst es an ein OCR Programm. Meldet da einen Fehler, weil gerade eine Hand im Bild ist oder der Spielstand nicht plausibel ist, machst Du ...
by yfpiLiker
Tue Oct 09, 2018 7:20 am
Forum: Python
Topic: using import filename
Replies: 5
Views: 300

Re: using import filename

There is a more powerful or easier tool
called importlib.

You can import it as module:

Code: Select all

import importlib


And it provides Methods like

Code: Select all

importlib.import_module()

Check this out:

https://docs.python.org/3/library/importlib.html
by yfpiLiker
Tue Oct 09, 2018 7:17 am
Forum: Python
Topic: using import filename
Replies: 5
Views: 300

Re: using import filename

Code: Select all

import module as mod

is nearly the same like

Code: Select all

mod = __import__("module")
by yfpiLiker
Tue Oct 09, 2018 7:15 am
Forum: Python
Topic: using import filename
Replies: 5
Views: 300

Re: using import filename

import module is nearly the same like module = __import__("module") Here is an example programm with user input: user_ module = input('Which module should be imported?") module = __import__(user_module) # do sth with the module # like calling #module.start() # if that's the start method of your gam...
by yfpiLiker
Tue Oct 09, 2018 7:07 am
Forum: Python
Topic: using import filename
Replies: 5
Views: 300

Re: using import filename

I tried in the python Shell the importing.
What I get is, a syntax error:

Code: Select all

>>> import 'tkinter'
SyntaxError: invalid syntax
by yfpiLiker
Tue Oct 09, 2018 7:05 am
Forum: Python
Topic: using import filename
Replies: 5
Views: 300

Re: using import filename

Hello,
first: please, write your code into into a code block (using the Code button in the Post a Reply page).
Loke this:

Code: Select all

 enter your code here  
by yfpiLiker
Mon Oct 08, 2018 6:31 pm
Forum: Python
Topic: Push button database help
Replies: 3
Views: 589

Re: Push button database help

A couple of ways: Create another program to handle the button - multiple programs can run at once on the Pi and access the database Use interrupts in the code for the temp logger. Have a look at the discussion in this thread here https://www.raspberrypi.org/forums/viewtopic.php?f=32&t=222372 Only a...
by yfpiLiker
Sun Oct 07, 2018 7:39 am
Forum: Python
Topic: please help me out! timer needed in python script!
Replies: 4
Views: 1583

Re: please help me out! timer needed in python script!

Why don't you start an own thread for the the leds? # put this to the other imports from _thread import start_new # is old but works fine # after setting up the GPIO # before the code you posted def blink(): GPIO.output(15, False) #RGB ROOD sleep(0.1) GPIO.output(15, True) #RGB ROOD sleep(0.1) GPIO....
by yfpiLiker
Sun Oct 07, 2018 7:04 am
Forum: Python
Topic: imports and classes
Replies: 3
Views: 352

Re: imports and classes

Here is an example as proof: # file named "testimport.py" import time ID = id(time) print(ID) # file in the same directory import time print(id(time)) import testimport print(testimport.ID == id(time)) print(id(testimport.time) == id(time)) The output of the second file: 63500768 63500768 True True ...
by yfpiLiker
Thu Oct 04, 2018 7:50 pm
Forum: Python
Topic: Tkinter updating label from outside class
Replies: 2
Views: 1891

Re: Tkinter updating label from outside class

Actually, you create a MyWindow instance, which packs a Label in the root window. root = tk.Tk() run = MyWindow(root) run.label.config(text = 'dddddddddd') Then you create a second MyWindow instance, which does the same. MyWindow(root).pack() So at the end there are two Labels. If you don't like tha...
by yfpiLiker
Thu Oct 04, 2018 7:30 pm
Forum: Python
Topic: comparing keyboard entry to filenames in a directory
Replies: 5
Views: 708

Re: comparing keyboard entry to filenames in a directory

Hello, I think you could use the os.path module. import os.path # create here the path for the file # and assigne the path to the variable path if os.path.exists(path): # Play the file # or do what you want else: # raise an error # or show an error message I hope that's what you want. YfpiLiker
by yfpiLiker
Thu Mar 29, 2018 5:44 am
Forum: Python
Topic: MCPI: Delete a user defined area
Replies: 11
Views: 1015

Re: MCPI: Delete a user defined area

Hi, Yes, that should work. And at the end you write: mc.setBlocks(x1, y1, z1, x2, y2, z2, 0) You don't Need to import mcpi.blocks. In my programs, I give the method the number of the blocks. 0 is Air You can look up the other names and numbers in the library. It is located /opt/minecraft-pi/api/pyth...
by yfpiLiker
Wed Mar 28, 2018 5:45 am
Forum: Python
Topic: GUI - Button doesn't work
Replies: 15
Views: 1209

Re: GUI - Button doesn't work

@bensimmo in 2017 you opened a similiar topic. Why are you so late with your .after()-method? :shock:

Go to advanced search