w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML Categories
Pygame error : video system not initialized
You don't break your while loop after calling pygame.quit(). Just use while 1: ev = pygame.event.poll() if ev.type == pygame.QUIT: break pygame.quit() or something like that. Otherwise, you'll call pygame.event.poll() after pygame.quit() on the next iteration of the loop, which will lead to your error.

Categories : Python

Even with pygame initialized "video system not initialized" gets thrown
Even if you initialize Pygame, you need to call to display.set_mode to avoid this error: pygame.init() pygame.display.set_mode((width, height)) # rest of the code This happens because the event queue needs the video mode to be set to work properly. From the documentation: The input queue is heavily dependent on the pygame display module. If the display has not been initialized and a video mode not set, the event queue will not really work.

Categories : Python

Pygame Error: Mpeg video will not play
I had this error myself, and I fixed it using ffmpeg and converting my .mpg video with this command:* ffmpeg -i input.mp4 -target ntsc-vcd -vcodec mpeg1video -an output.mpg * This answer was found on the Linux Distro Community forum.

Categories : Python

Pygame screen crashes without error report
I'm fairly sure that you aren't inserting too many things onto the screen. I believe that the problem is far more simple. You have said screen.flip() However, a surface object has no attribute called flip. You must be confused with the function pygame.display.flip() If you use this instead, the game shall display its visual output.

Categories : Python

Library not initialized in Python (pygame)
Alright I fixed it. The line: self.font = pygame.font.Font( None, self.text_size ) Was in a new Thread, therefore the libraries wasn't recognized So I got the font and made the label in the __init__ function and made them as self. after that I could use them in the Thread without a problem, because I took the font - made it as a surface (Font.render) and used.

Categories : Python

In the System.java source, the standard input, output and error streams are declared final and initialized null?
This is done in order to prevent "hacking". These fields can be changed only by appropriate setters that call native methods private static native void setIn0(InputStream in); private static native void setOut0(PrintStream out); private static native void setErr0(PrintStream err); Native methods can do everything including changing final fields.

Categories : Java

Make an item disapear when the player touch 2 times the touch screen
On the first tap set a variable (eg screenTap) to true and set up a Timer for the maximum amount of milliseconds you will allow between taps in a double-tap. When the Timer expires reset screenTap to false. Then, in your tap screen handler, check if screenTap is true. If so, remove the item.

Categories : Actionscript

Android - Detect Touch Pressure on capacitive touch screen?
MotionEvent().getPressure(i) should return a value between 0 and 1 based on the "pressure" placed on the screen. In reality for capacitive screens it is the size of the capacitive object rather than literal pressure, but the concept is almost the same for fingers (fingers are squishy). Ranges higher than one may be returned depending on the calibration of the touchscreen. If your screen is only returning 0 or 1, try testing on another device. Perhaps your screens driver simply does not return those values. MotionEvent | Android Developers : getPressure()

Categories : Java

No video file created by OpenCV 2.3.1 with Python on Raspberry Pi
I eventually went through and tried all of the fourcc codecs and none worked. Same with the mpeg2 codec. I ended up using avconv to create and capture the video with this line: import os os.system("avconv -f video4linux2 -input_format mjpeg -i /dev/video0 output.avi") os.system() is used to run a terminal command. OpenCV can still be used to process the video files at a later time. Hope this helps someone.

Categories : Opencv

touch/resources/sass/sencha-touch/base Failed to load resource error sencha touch 2
That is purely my fault .. In index.html I added base.scss file instead of adding base.css ,that is why it raising an error.I updated my index.html and now it is working fine . Thank you for those who helped me

Categories : Extjs

Open native video player (full screen) when video is pressed in a WebView
The question got a little sideways at the end, but I'll respond to the base question. 1.) "I need to open a native video player any time a user clicks on a video" Verify the link is a video, and fire an intent for ACTION_VIEW, Here's an example: public boolean shouldOverrideUrlLoading(WebView view, String url) { if (url.endsWith(".mp4")) { Intent intent = new Intent(Intent.ACTION_VIEW); intent.setData(Uri.parse(url)); startActivity(intent); return true; } else view.loadUrl(url); return false;

Categories : Android

Open video in full Screen on Samsung video player
You can open any file in an external app with this code: Intent intent = new Intent(Intent.ACTION_VIEW); MimeTypeMap map = MimeTypeMap.getSingleton(); String ext = MimeTypeMap.getFileExtensionFromUrl(file.getName()); String type = map.getMimeTypeFromExtension(ext); if (type == null) type = "*/*"; intent.setDataAndType(Uri.fromFile(file), type); intent.setFlags(Intent.FLAG_ACTIVITY_NO_HISTORY); It will automatically choose a app for you from your device, if there is more than one app that can open the file it will ask which one you would like to use. on my tablet it opens videos in full screen.

Categories : Android

Python/pygame - turning images into video
I have the same problem and am searching the solution. I found this This seems work well though I didn't try yet. Hope this helps.

Categories : Python

Android Raspberry pi W/System.err(13264): java.net.ConnectException connection refused
There are multiple strange things going on here. You might want to try the -k flag on netcat - it means the connection will stay. Your awk-script seems to make sure only the last line of the file is sent. Is this intentional? You do a rather violent hang-up in the java-code - when you got your message, you close the socket. Consider reading all of the message, filtering out what you need, and closing the socket in a finally block at the end. (It is always a good idea to close resources in a finally-block.)

Categories : Android

PyGame-Character Goes Off Screen
When you used pygame.draw.rect, you didn't actually create a "physical" boundary- you just set the colour of the pixels on the screen in a rectangular shape. If you know the size of the screen, and the displacement of all of the objects on the screen (only applicable if your game has a scrolling playfield or camera), then you can do something like this: # In the lines of code where you have the player move around # I assume you might be doing something like this if keys[pygame.K_RIGHT]: player.move(player.getSpeed(),0) # giving the x and y displacements if keys[pygame.K_LEFT]: player.move(-player.getSpeed(),0) ... class Player: ... def move(self, dx, dy): newX = self.x + dx newY = self.y + dy self.x = max(0, min(newX, SCREEN_WIDTH)) # you handle

Categories : Python

Why is my Screen Still Black in pygame?
Use pygame.display.flip() after you are done with your drawing. Look at the display module documentation for pygame. First you draw your game objects to the display surface. Then you "flip" it (actually show it on the screen). Every time you do this, you display one "frame" to the screen. Most modern games run at 60 FPS(frames per second) or more due to level of comfort on the human eye. This means that they iterate through a loop 60 times where they draw things to the display surface and then do pygame.display.flip to submit the new surface to the display. You can regulate the number of times your loop executes by using pygame.clock.tick. This lets you set a maximum framerate that is platform-independent. Again all of this is described pretty well in the Pygame documentation. Ask me if y

Categories : Python

Pygame image screen fill
The y-axis is positive as you go down the screen - so while your first row is at a y-position of 0, the next row will be at a y-position of 100. Basically, you should be adding to the y-coordinate, not subtracting.

Categories : Python

How can I blit my selection to the screen in pygame?
Blitting is basically the process of drawing one image(or surface) A into a second image B one pixel at a time. The easiest way to achieve that would be to clear out the screen, draw all the elements (called sprites) in their respective position. Looking at your code, I see that you don't use the item (x,y) coordinates to draw your cards, instead you are using their index n. Which basically, will always draw your card on the same location without any regards to their coordinates. First, instead of storing the items on one list and the images on a second list and the rects on a third list, I would use a single class: from rect import Rect class Card: def __init__(self, name, x, y, width, height, image): self.name = name self.x = x self.y = y

Categories : Python

How to take screenshot of certain part of screen in Pygame
If you always want the screenshot to be of the same portion of the screen, you could use the subsurface. http://www.pygame.org/docs/ref/surface.html#pygame.Surface.subsurface rect = pygame.Rect(25, 25, 100, 50) sub = screen.subsurface(rect) pygame.image.save(sub, "screenshot.jpg") The subsurface would work well in this scenario because any changes to the parent surface (screen in this case) will be applied to the subsurface as well. If you want to be able to specify an arbitrary portion of the screen to take a screenshot of (so, not the same rectangle every time) then it would probably be better to create a new surface, blit the desired portion of the screen to that surface, and then save it. rect = pygame.Rect(25, 25, 100, 50) screenshot = pygame.Surface(100, 50) screenshot.blit(scre

Categories : Python

sprite_sheet system in python and pygame
I think you should change some names, because you are using sprites an frames for the same thing. Also you have the word slef instead of self. I propose the following: class Player(pygame.sprite.Sprite): def __init__ (self, frames, *groups): super(player,self).__init__(*groups) frame = 0 self.image = frames[frame] ... class Game(object): def main(self, screen): sprite = pygame.image.load('test.png') frames = sprite_system().slice_sheet(sprite,0,0,64,64,4) sprites = pygame.sprite.Group() self.player = Player(frames, sprites) ... Notes: Changed player class to capital P Player (standard for Python classes) Changed the first player argument to frames Changed the variable that receives the slice_sheet to f

Categories : Python

VideoJS player not loading .webm video file for Firefox (throws "Video Error". Works when no other video sources (like mp4/mov) are provided
It seems mov videos are not supported by HTML5 Firefox implementation, I get this error: Specified "type" attribute of "video/mp4" is not supported. Load of media resource http://dev.muzioapp.com.s3-website-us-east-1.amazonaws.com/content/ourMuzeVid1.mov failed. The explanation about this (maybe) confusion is here: http://stackoverflow.com/a/5080583/208067 When the video is not embedded as a html5 video, Firefox looks for a suitable plugin to play the video and finds QuickTime. The video tag does not.

Categories : HTML

Pygame in Python: Screen.Blit Problems
screen.blit(game_over1(300,250)) docs: pygame.Surface screen.blit(game_over1, (300,250))

Categories : Image

windows phone 8 OnTouchFrameReported method fires on every screen once initialized
I ran into a similar problem recently. What I did was remove the method from Touch.FrameReported whenever I was not dealing with the frame I wanted simply by doing: Touch.FrameReported -= OnTouchFrameReported; I know you don't want to involve XAML but I created a mouseLeftButtonDown and MouseLeftButtonUp event for the control I was working with and added and removed the touch frame reported method respectively. XAML <Image MouseLeftButtonDown="mouseDown" MouseLeftButtonUp="mouseUp"/> Code public void mouseDown(object sender, MouseButtonEventArgs m) { Touch.FrameReported += OnTouchFrameReported; } public void mouseUp(object sender, MouseButtonEventArgs m) { Touch.FrameReported -= OnTouchFrameReported; }

Categories : C#

In pygame how to make an object controlled with arrow keys not move of the edge of the screen
On each handle of the input, check if the object's target x position plus its width exceeds the width of the canvas or if it is less than 0. Deny the movement if so. Repeat for the y coordinate and the height.

Categories : Python

pygame not updating the screen and enemy AI moving past player though conditons aren't met
Your code only updates the alien movement direction when some event takes place, so it will always wait for some user action before it can "turn around". If you get the alien "AI" update out of the inner loop, everything should get back to normal if w < x: movew =+ 0.2 if w > x: movew =- 0.2 if z < y: movez =+ 0.2 if z > y: movez =- 0.2 x += movex y += movey w += movew z += movez should look like if w < x: movew =+ 0.2 if w > x: movew =- 0.2 if z < y: movez =+ 0.2 if z > y: movez =- 0.2 x += movex y += movey w += movew z += movez

Categories : Python

Detect touch on a video element on iphone
I've managed to do it! Short answer IOS prevents any elements overlaying a video tag to have working click function methods on top of it (click functions will just be ignored). The solution is to NOT use a video tag initially but to make your own div tag with data-tag elements on it. Once you click this div, you then need to inject all the important values into a video tag on the fly. Once this is done you can then run your own video player script (I piggy backed on video js). I have a working zip folder example which is based on the bbc iplayer = http://www.andy-howard.com/recreate-bbc-iplayer/index.html Please spread this around. This has taken me alot of time to make so I hope you find it useful.

Categories : Jquery

Detect every touch on the screen
You should implement that OnTouchListener for the parent view and make child views non-clickable using setClickable(false)... If that doesn't work you probably need to follow the method suggested in this answer

Categories : Android

how to expand an HTML5 video to touch left/right edges?
if it doesn't "touch both edges" then probably you have padding and margins in your parents element, try putting margin:0px ; padding: 0px; in body and html or maybe using some reset css available somewhere. Anyway that video is a width:100% and height:100%; in a container with fixed width and height calculated via javascript depending on the browser size.

Categories : HTML

WPF Scrollviewer on touch screen tablet
You can enable scrolling with the PanningMode property like this: <ScrollViewer PanningMode="Both"></ScrollViewer>. See: MSDN Mouse support If you want to implement this behavior with the mouse, please read this article.

Categories : Wpf

Determine if the device has touch screen or not
PackageManager will refer to the Android player itself which probably has a touchscreen. It cannot detect if the player display is being routed to an external monitor via HDMI. When you ask the package manager if the device has a touchscreen, it is referring to the player and not the external display. One thing you could do is to detect if the player is connected to an external display by checking if HDMI port is active and change your navigation accordingly. See: Detect HDMI Port in android device Side note: If the player does not have a touchscreen but the package manager is wrongly reporting that it does, then it's either a bug with package manager or the device manufacturers implementation of Android might be buggy.

Categories : Android

How to know user touch on pattern screen?
Android provides several APIs that let you help to know whether a user interface control is focusable and even request that a control be given focus: Directional controls when its android:focusable attribute is set to true. setFocusable() isFocusable() requestFocus()

Categories : Android

Double tap in Resistive touch screen
Yes. There is the onDoubleTabListener() http://developer.android.com/reference/android/view/GestureDetector.OnDoubleTapListener.html

Categories : Android

How to get coordinates of touch screen points in ogl?
You can transform screen co-ords to opengl using a transform matrix and your camera position. See: http://stackoverflow.com/a/11716990/1369222

Categories : Android

SSL error on Raspberry Pi
I encountered this problem yesterday. First thing to try is to change the account from which you want to send an email to some other provider: try gmail, for instance. In my case it started working instantly. If it's also the case for you (Microsoft's fault?), try another thing with windows live account (similar to the one suggested in the comment):openssl s_client -connect smtp.live.com:587 -starttls smtp -crlf -ign_eof then type: ehlo auth login In my case nothing happened. No answer, only read timeout. This time try: openssl s_client -connect smtp.live.com:587 -starttls smtp -crlf -ign_eof -no_tls1_2 Then: ehlo auth login I got an answer immediately. If it's still your case, there's a little problem. I haven't found any way to specify such a parameter (which versions of tls to preve

Categories : Python

Insert image to screen at touch co-ordinates
Try this: public boolean onTouch(View v, MotionEvent event) { if (event.getAction() == MotionEvent.ACTION_DOWN){ int x = (int) event.getX() ; int y = (int) event.getY(); RelativeLayout.LayoutParams lp =new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT);; //Assuming you use a RelativeLayout ImageView iv=new ImageView(getApplicationContext()); lp.setMargins(x,y,0,0); iv.setLayoutParams(lp); iv.setImageDrawable(getResources().getDrawable(/*id of your image*/)); ((ViewGroup)v).addView(iv); }

Categories : Java

Injection of touch events using screen driver
Based on the sample values it appears that the Touchscreen is (600, 1024), Mapped to a (1024,600) display. To generate a touch event at (X,Y)display co-ordinates, the (x,y)touch co-ordinates that need to be injected can be calculated as follows x(touch) = (600/1024) * X(disp) y(touch) = (1024/600) * Y(disp)

Categories : Java

Turn off default screen touch sound
This may be what you're looking for... http://developer.android.com/reference/android/view/View.html#setSoundEffectsEnabled(boolean)

Categories : Android

Sencha touch splash screen issue
Phonegap allows you to delay the hiding of "native" splash screen to the moment where your application is actually ready to show something. Check their docs on Splashscreen: For iOS: The config.xml file's AutoHideSplashScreen setting must be false. To delay hiding the splash screen for two seconds, add a timer such as the following in the deviceready event handler: setTimeout(function() { navigator.splashscreen.hide(); }, 2000); If using Phonegap is not an option, you can still style your index.html with a background image to make it look the same as the splash screen (or very close). Look out for two things: There could be a gap between the native splashscreen and your index.html due to the statusbar: native splashscreen height is your webview height + statusbar height

Categories : HTML

Screen turn off after a while because in my game there are no touch events
What you need is system.setIdleTimer( false ) The api controls the idle timer of the system. If the idle timer is disabled, the screen will not be dim.

Categories : Lua

How to get touch position of screen for any control objective c?
Your code prints the location of the touch in the view that it occured in. So if you touch a 50x100 sized button in the middle, it will print "Point 25.0, 50.0". If you want to find the touch location of UIScreen, you have to convert the value: - (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldReceiveTouch:(UITouch *)touch { CGPoint point = [touch locationInView:touch.view]; CGPoint pointOnScreen = [touch.view convertPoint:point toView:nil]; NSLog(@"Point - %f, %f", pointOnScreen.x, pointOnScreen.y); NSLog(@"Touch"); return NO; // handle the touch } Or just immediately get the coordinate in the window (screen) space: - (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldReceiveTouch:(UITouch *)touch { CGPoint pointO

Categories : Iphone



© Copyright 2017 w3hello.com Publishing Limited. All rights reserved.