how do i make a button in python 3 run multiple commands. i want to have a button that plays a sound file and shuts down a computer [closed] - python-3.x

Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 3 days ago.
Improve this question
my current code is
#some of the import funtions are not used as i have tried multiple different ways to play sound and dont know which ones i can delete
from tkinter import *
import winsound
import sound
import os
def shutdown():
return os.system("shutdown /s /t 1")
winsound.PlaySound("mp3", winsound.SND_FILENAME)
master = Tk()
master.configure(bg='red')
Button(master, text="Click For Funny", command=shutdown).grid(row=0)
mainloop()
I tried lots of things including making a separate file and importing that. I couldn't get that to work. currently, the shutdown function works, but not the sound.

Related

Im trying to figure out why my squars wont fill with the color black when using turtle library [closed]

Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 1 year ago.
Improve this question
Im trying to fill some squars with the color black, but it wont fill
my code:
from turtle import *
setup(1920,1080,0,0)
k=Turtle()
k.right(45)
størrelse=40
n=int(input("Hvor mange diamanter? "))
for i in range(n+1):
color("black")
if i!=0:
if i%2!=0:
begin_fill()
for c in range(4):
k.forward(i*størrelse)
k.right(90)
end_fill()
else:
for c in range(4):
k.forward(i*størrelse)
k.right(90)
k.penup()
k.left(90)
k.forward(størrelse/2)
k.left(90)
k.forward(størrelse/2)
k.left(180)
k.pendown()
done()
If i use this code i only get squars, but they are not filled any solutions?
forgot "k." infront of fill and end function

What is "neg_mean_absolute_error" and where can I find it? [closed]

Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 2 years ago.
Improve this question
I am new to machine learning. I am trying to learn feature selection from this link. Here they have a line of code which is given below
search = GridSearchCV(pipeline, grid, scoring='neg_mean_squared_error', n_jobs=-1, cv=cv)
But whenever I try to run this code I get the error
I cannot find where to import neg_mean_squared_error from. I am not sure where I should write the function myself or not. The tutorial isn't clear on this issue.
It is just a typo.
You need
neg_mean_absolute_error
You typed
neg_mean_absolure_error
using an r instead of t
Reference: https://scikit-learn.org/stable/modules/model_evaluation.html

cannot import name 'AsyncIOSchedular' [closed]

Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 2 years ago.
Improve this question
import asyncio
import trollius
import datetime
import atexit
from apscheduler.schedulers.asyncio import AsyncIOSchedular
This gives
ImportError: cannot import name 'AsyncIOSchedular'
python version: 3.6.5
os is ubuntu
Note: APSchedular is installed version==3.6.3 and its BackgroundSchedular is working just fine.
What can be the reasons behind this? Thanks
It's spelled "Scheduler" not "Schedular".

I have a code where I import another code file, but the other code gets executed before my actual code runs [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 3 years ago.
Improve this question
So I am making a Voice assistant, and then I have to import another file, but the file always gets executed.
So I know there is a fix using an if loops but none of the answers are elaborate enough.
#voice_assistant
import math;
import DayCal2; #DayCal is a code I made to calculate the number of days between a user input day and the current date...
The DayCal code starts running as an individual code!
What you want to do is write everything in your second module that runs right away inside a check like this:
if __name__ == "__main__":
do_things()
this way, your do_things() function will be called if you open up this file and run it directly, BUT if you import this file, the __name__ will not be "__main__" so your do_things() function will not be called in this case.

Azure functions pulse - no data [closed]

Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 6 years ago.
Improve this question
I recently created my first Azure Function, which runs fine - I've had ~16,000 requests in the last hour which I can see under the monitor tab. However the pulse telemetry screen shows nothing - just empty graphs as if no functions are being run. I've done the whole opening new tabs, different browsers, reboot thing and no change.
Any ideas?
We identified the root cause of the problem and fixed this.
The fix has been deployed to production. Please try again.

Resources