Go to advanced search

by vajra11
Thu Feb 14, 2019 8:53 am
Forum: Python
Topic: How to compare current and next day
Replies: 27
Views: 1319

Re: How to compare current and next day

rzane0110 wrote:
Wed Feb 13, 2019 9:23 am
You can get your current date using curdate and then store it in a variable and compare it with other date.
I tried a lot but not getting result
by vajra11
Tue Feb 12, 2019 5:41 pm
Forum: Python
Topic: How to compare current and next day
Replies: 27
Views: 1319

Re: How to compare current and next day

If that's what you really want to see (and I can't imagine why you would want things to work like this :) ), you are going to have to have two separate threads (or processes, but this would probably be overkill), one to reset the count variable every minute and the other to respond to the trigger. ...
by vajra11
Tue Feb 12, 2019 9:28 am
Forum: Python
Topic: How to compare current and next day
Replies: 27
Views: 1319

Re: How to compare current and next day

It only updates when you trigger the gpio pin because the only change to your counter variable is inside the display_and_clear() function, and that function is only invoked in response to the INPUT_PIN being triggered. If you don't trigger the gpio pin the code could run for hours without the count...
by vajra11
Tue Feb 12, 2019 8:37 am
Forum: Python
Topic: How to compare current and next day
Replies: 27
Views: 1319

Re: How to compare current and next day

The datetime class provides a rich set of methods and fields. See https://docs.python.org/3/library/datetime.html for more information. I am facing little bit problem in code from tkinter import * import RPi.GPIO as GPIO import datetime INPUT_PIN=21 # change to 21 for your hardware setup now = date...
by vajra11
Sat Feb 02, 2019 2:57 pm
Forum: Python
Topic: scrolling message with status
Replies: 4
Views: 389

Re: scrolling message with status

Help you with what? I am explaining in detail. let's say I have push button, LED, LCD 16*2 and raspberry PI3. When I press the button, LEd goes turn ON else OFF. I want to display a message on the second line when led become turn ON and scroll a message " Raspberry " on the first line continuously
by vajra11
Thu Jan 31, 2019 11:04 am
Forum: Python
Topic: scrolling message with status
Replies: 4
Views: 389

Re: scrolling message with status

can somebody help me ???
by vajra11
Wed Jan 30, 2019 8:46 am
Forum: Python
Topic: scrolling message with status
Replies: 4
Views: 389

scrolling message with status

I have pi 3 and lcd 16*2 I want to scroll message " Rasbperry Pi " in first line of lcd and I want to display status of GPIO pin second line GPIO Program from time import sleep from time import sleep import RPi.GPIO as GPIO GPIO.setmode(GPIO.BCM) INPUT_PIN = 4 GPIO.setup(INPUT_PIN, GPIO.IN) # Start ...
by vajra11
Tue Jan 22, 2019 4:28 pm
Forum: General discussion
Topic: Guide me to interface sensor with Pi 3
Replies: 8
Views: 346

Re: Guide me to interface sensor with Pi 3

One thing I don't see is a ground connection between the 24V sensor and the pi. you should be fine using a potential divider as long as you rate the resistors correctly. Hello pcmanbob Thank's for helping with circuit please check connection for 24 v DC relay https://www.aliexpress.com/item/24V-DC-...
by vajra11
Tue Jan 22, 2019 12:34 pm
Forum: General discussion
Topic: Guide me to interface sensor with Pi 3
Replies: 8
Views: 346

Re: Guide me to interface sensor with Pi 3

if you follow your attached diagram it could prove fatal for your RPi "investment". normally when interfacing a sensor with different voltage source, a signal relay is required between the sensor and the RPi it may be a normal relay (24V relay in you case), or a logic level shifter, or an opto-isol...
by vajra11
Tue Jan 22, 2019 11:56 am
Forum: General discussion
Topic: Guide me to interface sensor with Pi 3
Replies: 8
Views: 346

Guide me to interface sensor with Pi 3

I have Photoelectric sensors and I am trying to interface it with Pi3 Untitled1.png I'm attaching link for sensor https://docs-emea.rs-online.com/webdocs/15b5/0900766b815b55c2.pdf import RPi.GPIO as GPIO import time GPIO.setmode(GPIO.BCM) GPIO.setup(20, GPIO.IN) #sensor GPIO.setup(19, GPIO.OUT) #BUz...
by vajra11
Wed Jan 16, 2019 11:47 am
Forum: Python
Topic: Interrupt doesn't work in script
Replies: 5
Views: 374

Re: Interrupt doesn't work in script

Something like this??? import tkinter as tk from time import sleep import RPi.GPIO as GPIO GPIO.setmode(GPIO.BCM) Counter_PIN = 12 GPIO.setup(Counter_PIN, GPIO.IN) global count class MainApplication(tk.Frame): def __init__(self, master): self.master = master tk.Frame.__init__(self, self.master) sel...
by vajra11
Wed Jan 16, 2019 11:24 am
Forum: Python
Topic: Interrupt doesn't work in script
Replies: 5
Views: 374

Re: Interrupt doesn't work in script

You know you aren't currently using count anywhere right? There is nothing to display it on the GUI. I am not getting entry value. I am mistaking here I found example code but not getting idea yet import tkinter as tk root = tk.Tk() root.geometry('600x400+80+40') class App: def __init__(self, root)...
by vajra11
Wed Jan 16, 2019 6:10 am
Forum: Python
Topic: Interrupt doesn't work in script
Replies: 5
Views: 374

Interrupt doesn't work in script

I think I am making mistake in script to set label value In script When interrupt pin triggered, interrupt doesn't happen import tkinter as tk from time import sleep import RPi.GPIO as GPIO GPIO.setmode(GPIO.BCM) Counter_PIN = 12 GPIO.setup(Counter_PIN, GPIO.IN) global count class MainApplication(tk...
by vajra11
Tue Jan 15, 2019 7:27 am
Forum: Python
Topic: How to display an image using tkinter in gui
Replies: 13
Views: 1642

Re: How to display an image using tkinter in gui

Read the tkinter documation or the ever useful effbot tkinterbook. http://effbot.org/tkinterbook/label.htm I suspect you want to set the "compound" option to either LEFT or RIGHT. my label is it in Frame1 but image is not in the Frame1 import tkinter as tk from PIL import Image, ImageTk class MainA...
by vajra11
Mon Jan 14, 2019 12:20 pm
Forum: Beginners
Topic: Interrupt-Driven Event-Counter on the Raspberry Pi
Replies: 6
Views: 355

Re: Interrupt-Driven Event-Counter on the Raspberry Pi

Updated version with if __name__ == '__main__' (which just tests if we are running as the "main" program, not as an imported module) Hi neilgl I was trying to implement with following script. I can set many framework labels, button and entry boxes class MainApplication(tk.Frame): def __init__(self,...
by vajra11
Mon Jan 14, 2019 11:20 am
Forum: Beginners
Topic: Interrupt-Driven Event-Counter on the Raspberry Pi
Replies: 6
Views: 355

Re: Interrupt-Driven Event-Counter on the Raspberry Pi

This is working for me with import as tk: import tkinter as tk from time import sleep import RPi.GPIO as GPIO GPIO.setmode(GPIO.BCM) Counter_PIN = 12 GPIO.setup(Counter_PIN, GPIO.IN) global count class Application(tk.Frame): def __init__(self, master): super(Application, self).__init__(master) self...
by vajra11
Sun Jan 13, 2019 9:52 am
Forum: Beginners
Topic: Interrupt-Driven Event-Counter on the Raspberry Pi
Replies: 6
Views: 355

Re: Interrupt-Driven Event-Counter on the Raspberry Pi

neilgl wrote:
Sat Jan 12, 2019 7:16 pm
This works with from IDLE (python 3) using a pushbutton on GPIO12 to give a a rising edge:
yah It work's but I am trying to do it with "import tkinter as tk"

How to do it with "import tkinter as tk"
by vajra11
Sun Jan 13, 2019 9:10 am
Forum: Python
Topic: How to display an image using tkinter in gui
Replies: 13
Views: 1642

Re: How to display an image using tkinter in gui

Ah! One of those tkinter gotchas! You need to make the images class properties otherwise they are destroyed when the function is finished. Adding self. in front of them does the job. See below Than you scotty How to set image in frame label should be in right side and logo (image)should be left sid...
by vajra11
Sat Jan 12, 2019 12:04 pm
Forum: Beginners
Topic: Interrupt-Driven Event-Counter on the Raspberry Pi
Replies: 6
Views: 355

Interrupt-Driven Event-Counter on the Raspberry Pi

Hi all; I am trying to get the interrupts to work using tkinter I have written this script import tkinter as tk from time import sleep import RPi.GPIO as GPIO import time GPIO.setmode(GPIO.BCM) Counter_PIN = 12 GPIO.setup(Counter_PIN, GPIO.IN) global count class MainProgram(tk.Frame): def __init__(s...
by vajra11
Sat Jan 12, 2019 5:00 am
Forum: Python
Topic: How to display an image using tkinter in gui
Replies: 13
Views: 1642

Re: How to display an image using tkinter in gui

please see my code in previous post. I don't know where I am making mistake Try this instead import tkinter as tk from PIL import Image, ImageTk class MainApplication(tk.Frame): def __init__(self, master): self.master = master tk.Frame.__init__(self, self.master) #NEW LINE BELOW!!! - Call to create...
by vajra11
Thu Jan 10, 2019 12:43 pm
Forum: Python
Topic: How to display an image using tkinter in gui
Replies: 13
Views: 1642

Re: How to display an image using tkinter in gui

scotty101 wrote:
Thu Jan 10, 2019 12:29 pm
vajra11 wrote:
Thu Jan 10, 2019 11:58 am
I understand it
What you said, I am doing here
If you were calling it, it would be working...

Post your latest code attempt.
please see my code in previous post. I don't know where I am making mistake
by vajra11
Thu Jan 10, 2019 11:58 am
Forum: Python
Topic: How to display an image using tkinter in gui
Replies: 13
Views: 1642

Re: How to display an image using tkinter in gui

You are calling create_image() from within create_widgets() but nowhere are you calling create_widgets() so neither will be run. I understand it What you said, I am doing here import tkinter as tk def function(Frame): label = tk.Label(Frame, text="Hello") label.pack(padx=20, pady=20) return if __na...
by vajra11
Thu Jan 10, 2019 11:32 am
Forum: Python
Topic: How to display an image using tkinter in gui
Replies: 13
Views: 1642

Re: How to display an image using tkinter in gui

You aren't calling the create_widgets method so the code call create_image doesn't get called therefore the code to display the image doesn't get called. If you put print statements in your code or run it though to tool with a debugger you will be able to debug these kind of things yourself. I adde...
by vajra11
Thu Jan 10, 2019 6:56 am
Forum: Python
Topic: How to display an image using tkinter in gui
Replies: 13
Views: 1642

How to display an image using tkinter in gui

this is code to display image on screen with tkinter from tkinter import * # pip install pillow from PIL import Image, ImageTk class Window(Frame): def __init__(self, master=None): Frame.__init__(self, master) self.master = master self.pack(fill=BOTH, expand=1) load = Image.open("parrot.jpg") render...
by vajra11
Tue Jan 08, 2019 5:41 am
Forum: Python
Topic: How to add checkbox
Replies: 10
Views: 499

Re: How to add checkbox

Personally, I'd all of the checkbox widgets inside their own tk.Frame. If you only have a small number of "subjects" for which you want checkboxes, why not create them all manually rather than using the for loop like you have done for the other fields? I have removed loop and created frame for chec...

Go to advanced search